From patchwork Wed Dec 26 11:27:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathyush K X-Patchwork-Id: 1910981 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 3DFD5DFAC4 for ; Wed, 26 Dec 2012 11:13:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35AE7E61EC for ; Wed, 26 Dec 2012 03:13:12 -0800 (PST) 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 8231FE60B8 for ; Wed, 26 Dec 2012 03:05:31 -0800 (PST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MFM00JGIXGI8NA0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 26 Dec 2012 20:05:30 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.123]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 69.8D.01231.AF9DAD05; Wed, 26 Dec 2012 20:05:30 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-53-50dad9fac648 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 49.8D.01231.AF9DAD05; Wed, 26 Dec 2012 20:05:30 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MFM0029MXGTEU90@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 26 Dec 2012 20:05:30 +0900 (KST) From: Prathyush K To: dri-devel@lists.freedesktop.org Subject: [PATCH 7/8] drm/exynos: hdmi: add complete_scanout function Date: Wed, 26 Dec 2012 06:27:44 -0500 Message-id: <1356521265-22749-8-git-send-email-prathyush.k@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1356521265-22749-1-git-send-email-prathyush.k@samsung.com> References: <1356521265-22749-1-git-send-email-prathyush.k@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkWvfXzVsBBnMahS2ufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxvEPbxkLPihVPDi7nb2BcZ1sFyMnh4SAiUTj5hZGCFtM4sK9 9WxdjFwcQgJLGSXaFqxjhynq7zvJApFYxChx9mYLM4SzkUni8KLZYFVsAtoSv+bcZQWxRQSU Jf5OXAU2lllAQuJI+1mgsRwcwgIuEk+e2YCEWQRUJd5PngFWzivgLtH8cgMTxDI5iQ97HoGN 5BTwkLiwcQ9YjRBQTduDD6wQvQIS3yYfYgEZKSEgK7HpADNE63U2ieO95RC2pMTBFTdYJjAK L2BkWMUomlqQXFCclJ5rqFecmFtcmpeul5yfu4kRGIKn/z2T2sG4ssHiEKMAB6MSD+/G7zcD hFgTy4orcw8xSnAwK4nwKqy6FSDEm5JYWZValB9fVJqTWnyI0QfokInMUqLJ+cD4yCuJNzQ2 MTc1NrU0MjIzNcUhrCTO2+yREiAkkJ5YkpqdmlqQWgQzjomDU6qBcfYcNpFliv+VZSv5pqyZ Za7+4Gh3I3PyRrX/zef+pxxkmbj8aw236OVzhx58FL3CKGi5c+6kFccaRdoy9DPX/0z7YmUa rfte8VDvho8nTjXV7DeQy+fbekuBte/kt38uMxhM03b2693fZL527YqiG8YnOmOYtasP/X+2 8ObLa1c+sM7Z7KnzNVaJpTgj0VCLuag4EQDaqnADbgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xgO6vm7cCDPr/cllc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMIaxozjH94yFnxQqnhwdjt7 A+M62S5GTg4JAROJ/r6TLBC2mMSFe+vZuhi5OIQEFjFKnL3ZwgzhbGSSOLxoNjtIFZuAtsSv OXdZQWwRAWWJvxNXMYLYzAISEkfazwJ1c3AIC7hIPHlmAxJmEVCVeD95Blg5r4C7RPPLDUwQ y+QkPux5BDaSU8BD4sLGPWA1QkA1bQ8+sE5g5F3AyLCKUTS1ILmgOCk911CvODG3uDQvXS85 P3cTIzjEn0ntYFzZYHGIUYCDUYmHd+P3mwFCrIllxZW5hxglOJiVRHgVVt0KEOJNSaysSi3K jy8qzUktPsToA3TVRGYp0eR8YPzllcQbGpuYmxqbWppYmJhZ4hBWEudt9kgJEBJITyxJzU5N LUgtghnHxMEp1cBYt3baSuHoBNF5Bpfu/H6r/ir0x/vKWYqd5xTXV0///M5lQ8vGmesYt8oY pv3vzXv3XM4hQOpdwUbXXRkCqtwSpaX7ryWvXxY5bW++5PzKbK9VHtpHN5gcvL1Zp3Rzmeid CaUvKhXuFc2I/TP3f8DmDS4bj3Otfjdj/5s/i6MZZSMMn1pJKBlPUGIpzkg01GIuKk4EALNo AiSeAgAA X-CFilter-Loop: Reflected 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 wait_for_vblank interface is modified to the complete_scanout function in hdmi. This inturn calls the complete_scanout mixer op. This patch also adds the mixer_complete_scanout function. Inside mixer_complete_scanout, we read the base register and shadow register for each window and compare it with the dma address of the framebuffer. If the dma_address is in the base register, the mixer window is disabled. If the dma_address is in the shadow register, then the function waits for the next vblank and returns. Signed-off-by: Prathyush K --- drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 11 ++++++---- drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 3 ++- drivers/gpu/drm/exynos/exynos_mixer.c | 37 +++++++++++++++++++++++++++++++- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index d8ae47e..e32eb1c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c @@ -177,14 +177,17 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx); } -static void drm_hdmi_wait_for_vblank(struct device *subdrv_dev) +static void drm_hdmi_complete_scanout(struct device *subdrv_dev, + dma_addr_t dma_addr, + unsigned long size) { 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->ctx); + if (mixer_ops && mixer_ops->complete_scanout) + mixer_ops->complete_scanout(ctx->mixer_ctx->ctx, + dma_addr, size); } static void drm_hdmi_mode_fixup(struct device *subdrv_dev, @@ -263,7 +266,7 @@ static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { .apply = drm_hdmi_apply, .enable_vblank = drm_hdmi_enable_vblank, .disable_vblank = drm_hdmi_disable_vblank, - .wait_for_vblank = drm_hdmi_wait_for_vblank, + .complete_scanout = drm_hdmi_complete_scanout, .mode_fixup = drm_hdmi_mode_fixup, .mode_set = drm_hdmi_mode_set, .get_max_resol = drm_hdmi_get_max_resol, diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index 4fad00c..7d5bf00 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -51,7 +51,8 @@ struct exynos_mixer_ops { int (*iommu_on)(void *ctx, bool enable); int (*enable_vblank)(void *ctx, int pipe); void (*disable_vblank)(void *ctx); - void (*wait_for_vblank)(void *ctx); + void (*complete_scanout)(void *ctx, dma_addr_t dma_addr, + unsigned long size); void (*dpms)(void *ctx, int mode); /* overlay */ diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 3369d57..151e13f 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -861,6 +861,41 @@ static void mixer_wait_for_vblank(void *ctx) DRM_DEBUG_KMS("vblank wait timed out.\n"); } +static void mixer_complete_scanout(void *ctx, dma_addr_t dma_addr, + unsigned long size) +{ + struct mixer_context *mixer_ctx = ctx; + struct mixer_resources *res = &mixer_ctx->mixer_res; + int win; + bool in_use = false; + bool in_use_s = false; + + if (!mixer_ctx->powered) + return; + + for (win = 0; win < MIXER_WIN_NR; win++) { + dma_addr_t dma_addr_in_use; + + if (!mixer_ctx->win_data[win].enabled) + continue; + + dma_addr_in_use = mixer_reg_read(res, MXR_GRAPHIC_BASE(win)); + if (dma_addr_in_use >= dma_addr && + dma_addr_in_use < (dma_addr + size)) { + mixer_win_disable(ctx, win); + in_use = true; + } + + dma_addr_in_use = mixer_reg_read(res, MXR_GRAPHIC_BASE_S(win)); + if (dma_addr_in_use >= dma_addr && + dma_addr_in_use < (dma_addr + size)) + in_use_s = true; + } + + if (in_use) + mixer_wait_for_vblank(ctx); +} + static void mixer_window_suspend(struct mixer_context *ctx) { struct hdmi_win_data *win_data; @@ -969,7 +1004,7 @@ static struct exynos_mixer_ops mixer_ops = { .iommu_on = mixer_iommu_on, .enable_vblank = mixer_enable_vblank, .disable_vblank = mixer_disable_vblank, - .wait_for_vblank = mixer_wait_for_vblank, + .complete_scanout = mixer_complete_scanout, .dpms = mixer_dpms, /* overlay */