From patchwork Thu Aug 27 08:42:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyungwon Hwang X-Patchwork-Id: 7081681 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2C8D9BEEC1 for ; Thu, 27 Aug 2015 08:43:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31FF6209A2 for ; Thu, 27 Aug 2015 08:43:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C6F3E2099F for ; Thu, 27 Aug 2015 08:43:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2810C72006; Thu, 27 Aug 2015 01:43:10 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id C06086ECEE for ; Thu, 27 Aug 2015 01:43:08 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NTQ02SMVG7O3AA0@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 27 Aug 2015 17:43:00 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.115]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id B5.54.24422.49DCED55; Thu, 27 Aug 2015 17:43:00 +0900 (KST) X-AuditID: cbfee68f-f793b6d000005f66-0c-55decd94b849 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 51.00.23663.49DCED55; Thu, 27 Aug 2015 17:43:00 +0900 (KST) Received: from localhost.localdomain.localdomain ([10.252.82.145]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NTQ00HA1G7LBPO1@mmp1.samsung.com>; Thu, 27 Aug 2015 17:43:00 +0900 (KST) From: Hyungwon Hwang To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH] drm/exynos: implement {prepare/cleanup}_plane of DECON Date: Thu, 27 Aug 2015 17:42:55 +0900 Message-id: <1440664975-21379-1-git-send-email-human.hwang@samsung.com> X-Mailer: git-send-email 2.4.3 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrALMWRmVeSWpSXmKPExsWyRsSkWHfK2XuhBg9bRC2ufH3PZrF0Rh+r xaT7E1gcmD3udx9n8ujbsooxgCmKyyYlNSezLLVI3y6BK+PD77tMBdfVK9bOX8fewNij2MXI ySEhYCJxePt3NghbTOLCvfVANheHkMAKRonPy/ezwhQd3bmSGSKxlFHiysqXLBBOG5PEj883 GEGq2AT0JBZc+8EOYosIWEo82PqbGcRmFtCRuH5zC5DNwSEs4C6xZIM/SJhFQFVi58VNLCA2 L1C4peEEM8QyOYlz67+wQNhn2CR+zheGqBeQ+Db5EAvIGAkBWYlNB6DKJSUOrrjBMoFRcAEj wypG0dSC5ILipPQiY73ixNzi0rx0veT83E2MwIA7/e9Z/w7GuwesDzEKcDAq8fBKZNwLFWJN LCuuzD3EaAq0YSKzlGhyPjCs80riDY3NjCxMTUyNjcwtzZTEeRdK/QwWEkhPLEnNTk0tSC2K LyrNSS0+xMjEwSnVwOiUMnnJtt1yjyS2PxbO2FhlE3q24JW18oJLn3QcTk3++OD6Xv0agb4H 93Zr2q5SXtSr8etP+L9zLxY6cZQ0H532n3WV88Tip2sZmjy/MXhsj1h6cfMmK0eFEyWH4qT8 edfViv50OLZppzj/+98aEmvl9dw21Lgp3VJ7oejwYYHIpgVvX7701V+ixFKckWioxVxUnAgA jBChlTMCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsVy+t9jAd0pZ++FGrz/xG9x5et7NoulM/pY LSbdn8DiwOxxv/s4k0ffllWMAUxRDYw2GamJKalFCql5yfkpmXnptkrewfHO8aZmBoa6hpYW 5koKeYm5qbZKLj4Bum6ZOUBblBTKEnNKgUIBicXFSvp2mCaEhrjpWsA0Ruj6hgTB9RgZoIGE NYwZH37fZSq4rl6xdv469gbGHsUuRk4OCQETiaM7VzJD2GISF+6tZ+ti5OIQEljKKHFl5UsW CKeNSeLH5xuMIFVsAnoSC679YAexRQQsJR5s/Q3WzSygI3H95hYgm4NDWMBdYskGf5Awi4Cq xM6Lm1hAbF6gcEvDCahlchLn1n9hmcDIvYCRYRWjRGpBckFxUnquYV5quV5xYm5xaV66XnJ+ 7iZGcFg/k9rBeHCX+yFGAQ5GJR5eiYx7oUKsiWXFlbmHGCU4mJVEePcfAwrxpiRWVqUW5ccX leakFh9iNAU6YCKzlGhyPjDm8kriDY1NzIwsjcwNLYyMzZXEeWU3bA4VEkhPLEnNTk0tSC2C 6WPi4JRqYKyRrejN3O0gEKIgmDbnxRa7AKO7Rm71565LTnuyx+nvZxZ7y45ktdVSVx9VCKuH Smv0JMQnbjrLcjM7c2f+M7nQ/0d3d7hOiHquombcZm8hZv5PxtRj/4rYDbOXz5u2RehxctYs 5Xusl/X+tTq4eT0w1FF6+TZcd6sL7+abYr0etnP97J/pKbEUZyQaajEXFScCAChhSEyBAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Each CRTC's {prepare/cleanup}_plane must stop/start the update of shadow registers to active register in the functions. This patch achieves these purpose by moving the setting of protection bits to those functions from decon_update_plane. Signed-off-by: Hyungwon Hwang --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 34 +++++++++++++++++++++------ drivers/gpu/drm/exynos/exynos7_drm_decon.c | 30 ++++++++++++++++++----- 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 8d65e45..bd465ac 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -219,6 +219,17 @@ static void decon_shadow_protect_win(struct decon_context *ctx, int win, writel(val, ctx->addr + DECON_SHADOWCON); } +static void decon_prepare_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) +{ + struct decon_context *ctx = crtc->ctx; + + if (ctx->suspended) + return; + + decon_shadow_protect_win(ctx, plane->zpos, true); +} + static void decon_update_plane(struct exynos_drm_crtc *crtc, struct exynos_drm_plane *plane) { @@ -232,8 +243,6 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, if (ctx->suspended) return; - decon_shadow_protect_win(ctx, win, true); - val = COORDINATE_X(plane->crtc_x) | COORDINATE_Y(plane->crtc_y); writel(val, ctx->addr + DECON_VIDOSDxA(win)); @@ -265,15 +274,10 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, val |= WINCONx_ENWIN_F; writel(val, ctx->addr + DECON_WINCONx(win)); - decon_shadow_protect_win(ctx, win, false); - /* standalone update */ val = readl(ctx->addr + DECON_UPDATE); val |= STANDALONE_UPDATE_F; writel(val, ctx->addr + DECON_UPDATE); - - if (ctx->i80_if) - atomic_set(&ctx->win_updated, 1); } static void decon_disable_plane(struct exynos_drm_crtc *crtc, @@ -301,6 +305,20 @@ static void decon_disable_plane(struct exynos_drm_crtc *crtc, writel(val, ctx->addr + DECON_UPDATE); } +static void decon_cleanup_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) +{ + struct decon_context *ctx = crtc->ctx; + + if (ctx->suspended) + return; + + decon_shadow_protect_win(ctx, plane->zpos, false); + + if (ctx->i80_if) + atomic_set(&ctx->win_updated, 1); +} + static void decon_swreset(struct decon_context *ctx) { unsigned int tries; @@ -455,8 +473,10 @@ static struct exynos_drm_crtc_ops decon_crtc_ops = { .enable_vblank = decon_enable_vblank, .disable_vblank = decon_disable_vblank, .commit = decon_commit, + .prepare_plane = decon_prepare_plane, .update_plane = decon_update_plane, .disable_plane = decon_disable_plane, + .cleanup_plane = decon_cleanup_plane, .te_handler = decon_te_irq_handler, }; diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 7651499..d0edc56 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -383,6 +383,17 @@ static void decon_shadow_protect_win(struct decon_context *ctx, writel(val, ctx->regs + SHADOWCON); } +static void decon_prepare_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) +{ + struct decon_context *ctx = crtc->ctx; + + if (ctx->suspended) + return; + + decon_shadow_protect_win(ctx, plane->zpos, true); +} + static void decon_update_plane(struct exynos_drm_crtc *crtc, struct exynos_drm_plane *plane) { @@ -410,9 +421,6 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, * is set. */ - /* protect windows */ - decon_shadow_protect_win(ctx, win, true); - /* buffer start address */ val = (unsigned long)plane->dma_addr[0]; writel(val, ctx->regs + VIDW_BUF_START(win)); @@ -510,14 +518,22 @@ static void decon_disable_plane(struct exynos_drm_crtc *crtc, val &= ~WINCONx_ENWIN; writel(val, ctx->regs + WINCON(win)); - /* unprotect windows */ - decon_shadow_protect_win(ctx, win, false); - val = readl(ctx->regs + DECON_UPDATE); val |= DECON_UPDATE_STANDALONE_F; writel(val, ctx->regs + DECON_UPDATE); } +static void decon_cleanup_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) +{ + struct decon_context *ctx = crtc->ctx; + + if (ctx->suspended) + return; + + decon_shadow_protect_win(ctx, plane->zpos, false); +} + static void decon_init(struct decon_context *ctx) { u32 val; @@ -614,8 +630,10 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = { .enable_vblank = decon_enable_vblank, .disable_vblank = decon_disable_vblank, .wait_for_vblank = decon_wait_for_vblank, + .prepare_plane = decon_prepare_plane, .update_plane = decon_update_plane, .disable_plane = decon_disable_plane, + .cleanup_plane = decon_cleanup_plane, };