All of lore.kernel.org
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org
Cc: kyungmin.park@samsung.com
Subject: [PATCH v2] drm/exynos: add wait_for_vblank callback interface.
Date: Tue, 21 Aug 2012 11:23:20 +0900	[thread overview]
Message-ID: <1345515800-3969-1-git-send-email-inki.dae@samsung.com> (raw)
In-Reply-To: <1345466155-9154-7-git-send-email-inki.dae@samsung.com>

Changelog v2:
fixed comments.

Changelog v1:
this interface can be used to make sure that hardware overlay is disabled
to avoid that memory region is accessed by dma after gem buffer was released.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h     |   17 +++++++++++++++++
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |   10 ++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 24c45d8..eec77aa 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -37,6 +37,20 @@
 #define MAX_FB_BUFFER	4
 #define DEFAULT_ZPOS	-1
 
+#define _wait_for(COND, MS) ({ \
+	unsigned long timeout__ = jiffies + msecs_to_jiffies(MS);	\
+	int ret__ = 0;							\
+	while (!(COND)) {						\
+		if (time_after(jiffies, timeout__)) {			\
+			ret__ = -ETIMEDOUT;				\
+			break;						\
+		}							\
+	}								\
+	ret__;								\
+})
+
+#define wait_for(COND, MS) _wait_for(COND, MS)
+
 struct drm_device;
 struct exynos_drm_overlay;
 struct drm_connector;
@@ -61,6 +75,8 @@ enum exynos_drm_output_type {
  * @commit: apply hardware specific overlay data to registers.
  * @enable: enable hardware specific overlay.
  * @disable: disable hardware specific overlay.
+ * @wait_for_vblank: wait for vblank interrupt to make sure that
+ *	hardware overlay is disabled.
  */
 struct exynos_drm_overlay_ops {
 	void (*mode_set)(struct device *subdrv_dev,
@@ -68,6 +84,7 @@ struct exynos_drm_overlay_ops {
 	void (*commit)(struct device *subdrv_dev, int zpos);
 	void (*enable)(struct device *subdrv_dev, int zpos);
 	void (*disable)(struct device *subdrv_dev, int zpos);
+	void (*wait_for_vblank)(struct device *subdrv_dev);
 };
 
 /*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 08ba62f..f453116 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -430,4 +430,14 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
 
 	if (overlay_ops && overlay_ops->disable)
 		overlay_ops->disable(manager->dev, zpos);
+
+	/*
+	 * wait for vblank interrupt
+	 * - this makes sure that hardware overlay is disabled to avoid
+	 * for the dma accesses to memory after gem buffer was released
+	 * because the setting for disabling the overlay will be updated
+	 * at vsync.
+	 */
+	if (overlay_ops->wait_for_vblank)
+		overlay_ops->wait_for_vblank(manager->dev);
 }
-- 
1.7.4.1

  reply	other threads:[~2012-08-21  2:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-20 12:35 [PATCH 00/10 v2] updated exynos-drm-fixes Inki Dae
2012-08-20 12:35 ` [PATCH 01/10] drm/exynos: added device object to subdrv's remove callback as argument Inki Dae
2012-08-20 12:35 ` [PATCH 02/10] drm/exynos: separated subdrv_probe function into two parts Inki Dae
2012-08-21  4:07   ` [PATCH v2] " Inki Dae
2012-08-20 12:35 ` [PATCH 03/10] drm/exynos: fixed page align bug Inki Dae
2012-08-20 12:35 ` [PATCH 04/10] drm/exynos: separeated fimd_power_on into some parts Inki Dae
2012-08-20 12:35 ` [PATCH 05/10] drm/exynos: fixed duplicated mode setting Inki Dae
2012-08-20 12:35 ` [PATCH 06/10] drm/exynos: add wait_for_vblank callback interface Inki Dae
2012-08-21  2:23   ` Inki Dae [this message]
2012-08-20 12:35 ` [PATCH 07/10] drm/exynos: make sure that hardware overlay for fimd is disabled Inki Dae
2012-08-24  9:36   ` [PATCH v2] " Inki Dae
2012-08-20 12:35 ` [PATCH 08/10] drm/exynos: make sure that hardware overlay for hdmi " Inki Dae
2012-08-20 12:35 ` [PATCH 09/10] drm/exynos: check NV12M format specific to Exynos properly Inki Dae
2012-08-20 12:35 ` [PATCH 10/10] drm/exynos: update crtc to plane safely Inki Dae

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=1345515800-3969-1-git-send-email-inki.dae@samsung.com \
    --to=inki.dae@samsung.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kyungmin.park@samsung.com \
    /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 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.