From: Joonyoung Shim <jy0922.shim@samsung.com>
To: Inki Dae <inki.dae@samsung.com>
Cc: kyungmin.park@samsung.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 08/13] drm/exynos: make sure that hardware overlay for fimd is disabled
Date: Mon, 20 Aug 2012 11:09:43 +0900 [thread overview]
Message-ID: <50319C67.20204@samsung.com> (raw)
In-Reply-To: <1345197059-25583-9-git-send-email-inki.dae@samsung.com>
On 08/17/2012 06:50 PM, Inki Dae wrote:
> the values set to registers will be updated into real registers
> at vsync so dma operation could be malfunctioned when accessed
> to memory after gem buffer was released. this patch makes sure
> that hw overlay is disabled before the gem buffer is 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 ++++++++++
> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 12 ++++++++++++
Please split patch to exynos_drm part and fimd part.
> 3 files changed, 39 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..00e4bdc 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
> + * dma transfer is completed.
> */
> 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 7da5714..a562a94 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
> @@ -399,4 +399,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
> + * - with iommu, the dma operation could induce page fault
> + * when accessed to memory after gem buffer was released so
> + * make sure that the dma operation is completed before releasing
> + * the gem bufer.
> + */
> + if (overlay_ops->wait_for_vblank)
> + overlay_ops->wait_for_vblank(manager->dev);
> }
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 0ec9d86..2378d80 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -570,10 +570,22 @@ static void fimd_win_disable(struct device *dev, int zpos)
> win_data->enabled = false;
> }
>
> +static void fimd_wait_for_vblank(struct device *dev)
> +{
> + struct fimd_context *ctx = get_fimd_context(dev);
> + int ret;
> +
> + ret = wait_for((__raw_readl(ctx->regs + VIDCON1) &
> + VIDCON1_VSTATUS_BACKPORCH), 50);
> + if (ret < 0)
> + DRM_DEBUG_KMS("vblank wait timed out.\n");
> +}
> +
> static struct exynos_drm_overlay_ops fimd_overlay_ops = {
> .mode_set = fimd_win_mode_set,
> .commit = fimd_win_commit,
> .disable = fimd_win_disable,
> + .wait_for_vblank = fimd_wait_for_vblank,
> };
>
> static struct exynos_drm_manager fimd_manager = {
next prev parent reply other threads:[~2012-08-20 2:09 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 9:50 [PATCH 00/13] updated exynos-drm-fixes Inki Dae
2012-08-17 9:50 ` [PATCH 01/13] drm/exynos: added device object to subdrv's remove callback as argument Inki Dae
2012-08-17 9:50 ` [PATCH 02/13] drm/exynos: separated subdrv->probe call and encoder/connector creation Inki Dae
2012-08-20 1:11 ` Joonyoung Shim
2012-08-20 1:52 ` InKi Dae
2012-08-20 1:59 ` Joonyoung Shim
2012-08-20 4:31 ` InKi Dae
2012-08-20 4:42 ` Joonyoung Shim
2012-08-20 5:43 ` InKi Dae
2012-08-17 9:50 ` [PATCH 03/13] drm/exynos: fixed page align bug Inki Dae
2012-08-17 9:50 ` [PATCH 04/13] drm/exynos: use empty function instead of drm_helper_connector_dpms Inki Dae
2012-08-20 1:12 ` Joonyoung Shim
2012-08-20 2:50 ` InKi Dae
2012-08-17 9:50 ` [PATCH 05/13] drm/exynos: removed exynos_drm_encoder_dpms call Inki Dae
2012-08-20 1:14 ` Joonyoung Shim
2012-08-20 2:00 ` InKi Dae
2012-08-17 9:50 ` [PATCH 06/13] drm/exynos: separeated fimd_power_on into some parts Inki Dae
2012-08-17 9:50 ` [PATCH 07/13] drm/exynos: control display power at connector module Inki Dae
2012-08-17 9:50 ` [PATCH 08/13] drm/exynos: make sure that hardware overlay for fimd is disabled Inki Dae
2012-08-20 2:09 ` Joonyoung Shim [this message]
2012-08-17 9:50 ` [PATCH 09/13] drm/exynos: check NV12M format specific to Exynos properly Inki Dae
2012-08-20 1:17 ` Joonyoung Shim
2012-08-20 2:23 ` InKi Dae
2012-08-20 4:52 ` Joonyoung Shim
2012-08-20 5:11 ` InKi Dae
2012-08-20 5:15 ` InKi Dae
2012-08-20 5:22 ` Joonyoung Shim
2012-08-20 5:45 ` InKi Dae
2012-08-17 9:50 ` [PATCH 10/13] drm/exynos: update crtc to plane safely Inki Dae
2012-08-20 1:25 ` Joonyoung Shim
2012-08-17 9:50 ` [PATCH 11/13] drm/exynos: changed context name of hdmi and mixer Inki Dae
2012-08-20 1:27 ` Joonyoung Shim
2012-08-20 2:29 ` InKi Dae
2012-08-20 4:55 ` Joonyoung Shim
2012-08-20 6:17 ` InKi Dae
2012-08-20 6:36 ` Joonyoung Shim
2012-08-20 6:51 ` InKi Dae
2012-08-20 7:30 ` InKi Dae
2012-08-17 9:50 ` [PATCH 12/13] drm/exynos: fixed build warning Inki Dae
2012-08-17 9:50 ` [PATCH 13/13] drm/exynos: make sure that hardware overlay for hdmi is disabled 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=50319C67.20204@samsung.com \
--to=jy0922.shim@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox