From patchwork Fri Aug 17 09:50:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1338361 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id EDFD1DF266 for ; Fri, 17 Aug 2012 10:02:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB923A0E02 for ; Fri, 17 Aug 2012 03:02:47 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 40322A0E13 for ; Fri, 17 Aug 2012 02:51:09 -0700 (PDT) Received: from epcpsbgm2.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8W00BBS8OHZZ00@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 17 Aug 2012 18:51:04 +0900 (KST) X-AuditID: cbfee61b-b7faf6d00000476a-f0-502e14089910 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 07.6E.18282.8041E205; Fri, 17 Aug 2012 18:51:04 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M8W005HH8OZZTB0@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 17 Aug 2012 18:51:04 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH 13/13] drm/exynos: make sure that hardware overlay for hdmi is disabled Date: Fri, 17 Aug 2012 18:50:59 +0900 Message-id: <1345197059-25583-14-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: <1345197059-25583-1-git-send-email-inki.dae@samsung.com> References: <1345197059-25583-1-git-send-email-inki.dae@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIJMWRmVeSWpSXmKPExsVy+t9jQV0OEb0Ag73nLCyufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxrSZ3xkLbopXfPl1iKWBsUWki5GTQ0LARGLK0S0sELaYxIV7 69lAbCGB6YwSe3/EdTFyAdnrmSQ6bt0CK2ITUJWYuOI+WJGIgKlEx6SlYHFmgUKJhT1PgWwO DmGBSIn5ixJAwixA5Xcn7GIHsXkFXCXa7/YwQexSkFhw7y3YGE6g+N3lk5kg9rpING7uYZ3A yLuAkWEVo2hqQXJBcVJ6rpFecWJucWleul5yfu4mRrDHn0nvYFzVYHGIUYCDUYmH90CZboAQ a2JZcWXuIUYJDmYlEd4VH4FCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeb3+A6UE0hNLUrNTUwtS i2CyTBycUg2MqqvO+YctMtc51lj2S3q1yfQXq8IkPPddf9Cv8s8x3P5UYp5+XtLjJ8+2zvaa y25gr7id0VBD9Gq51O95Mi9mK2p7P+FNuB8k8Hl+oJCNXZ8Y90fjiO+fV6eZ7YwUsH15a9Hh h0U+924ry30KD7PuXFCy8paJ7KJH9v3bimauz7jr8PUQ3wEpJZbijERDLeai4kQAQyhoH/QB AAA= X-TM-AS-MML: No Cc: kyungmin.park@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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 Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 11 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 1 + drivers/gpu/drm/exynos/exynos_mixer.c | 13 +++++++++++++ 3 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 38250cb..6323cc8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -274,10 +274,21 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) ctx->enabled[win] = false; } +static void drm_mixer_wait_for_vblank(struct device *subdrv_dev) +{ + struct drm_hdmi_context *ctx = to_context(subdrv_dev); + + DRM_DEBUG_KMS("%s\n", __FILE__); + + if (mixer_ops && mixer_ops->wait_for_vblank) + mixer_ops->wait_for_vblank(ctx->mixer_ctx->client); +} + static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { .mode_set = drm_mixer_mode_set, .commit = drm_mixer_commit, .disable = drm_mixer_disable, + .wait_for_vblank = drm_mixer_wait_for_vblank, }; static struct exynos_drm_manager hdmi_manager = { diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index 237434d..93e8a2b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -67,6 +67,7 @@ struct exynos_mixer_ops { void (*dpms)(void *ctx, int mode); /* overlay */ + void (*wait_for_vblank)(void *ctx); void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); void (*win_commit)(void *ctx, int zpos); void (*win_disable)(void *ctx, int zpos); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index d3ff595..1ab5267 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -726,6 +726,18 @@ static void mixer_dpms(void *ctx, int mode) } } +static void mixer_wait_for_vblank(void *ctx) +{ + struct mixer_context *mixer_ctx = ctx; + struct mixer_resources *res = &mixer_ctx->mixer_res; + int ret; + + ret = wait_for((mixer_reg_read(res, MXR_INT_STATUS) & + MXR_INT_STATUS_VSYNC), 50); + if (ret < 0) + DRM_DEBUG_KMS("vblank wait timed out.\n"); +} + static void mixer_win_mode_set(void *ctx, struct exynos_drm_overlay *overlay) { @@ -818,6 +830,7 @@ static struct exynos_mixer_ops mixer_ops = { .dpms = mixer_dpms, /* overlay */ + .wait_for_vblank = mixer_wait_for_vblank, .win_mode_set = mixer_win_mode_set, .win_commit = mixer_win_commit, .win_disable = mixer_win_disable,