From patchwork Wed Mar 15 14:41:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9625825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD2A56048C for ; Wed, 15 Mar 2017 14:43:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FEF828624 for ; Wed, 15 Mar 2017 14:43:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9499928635; Wed, 15 Mar 2017 14:43:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F164B28624 for ; Wed, 15 Mar 2017 14:43:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753315AbdCOOmT (ORCPT ); Wed, 15 Mar 2017 10:42:19 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:65240 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752841AbdCOOlS (ORCPT ); Wed, 15 Mar 2017 10:41:18 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OMV00F1B24R6D60@mailout2.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 15 Mar 2017 14:41:15 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170315144114eucas1p15753e4c1f0e3eed0251c3f5d4e7edd65~sFTCE_vK80100201002eucas1p1B; Wed, 15 Mar 2017 14:41:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 39.FC.16908.D8259C85; Wed, 15 Mar 2017 14:41:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170315144114eucas1p115522a62b550b282bcd2df99e06be9ef~sFTBTZkiq0087700877eucas1p1H; Wed, 15 Mar 2017 14:41:14 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-2c-58c9528dab98 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 86.D0.06687.0F259C85; Wed, 15 Mar 2017 14:42:56 +0000 (GMT) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OMV00GPG24OBF60@eusync2.samsung.com>; Wed, 15 Mar 2017 14:41:14 +0000 (GMT) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Krzysztof Kozlowski , Javier Martinez Canillas Subject: [PATCH v3 02/10] drm/exynos/decon5433: implement frame counter Date: Wed, 15 Mar 2017 15:41:02 +0100 Message-id: <1489588870-7785-3-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1489588870-7785-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLIsWRmVeSWpSXmKPExsWy7djP87q9QScjDH6vF7a4te4cq8XGGetZ La58fc9mMen+BBaLN2/XMFmcP7+B3WLG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BsYXEl2MHBwSAiYSW86kdTFyApliEhfurWfr YuTiEBJYwihxZud/ZpCEkEAjk0TvhgQQm01AU+Lv5ptsILaIgLLEqn3t7CANzAIbmCTu9p1k BUkIC7hLPF2zlhFkAYuAqsTedWogYV4BJ4k7MycwQSyTk7h5rhNsPqeAs8T6c7OZIHY5Sbxq Psw0gZF3ASPDKkaR1NLi3PTcYkO94sTc4tK8dL3k/NxNjMCQ3nbs5+YdjJc2Bh9iFOBgVOLh neB7MkKINbGsuDL3EKMEB7OSCO8Nf6AQb0piZVVqUX58UWlOavEhRlOgmyYyS4km5wPjLa8k 3tDE0NzS0MjYwsLcyEhJnLfkw5VwIYH0xJLU7NTUgtQimD4mDk6pBsagm91tO6aIa1n2b6pg UUz4VJ54Z8/qsA9v+TJ76xWaF3TvdX1UV5LJJLOhsD8m+mLstT27ZsnF/J01Zfvdj34aVav1 G/98/Cy9JLZ276mtr1LeByx9nFbSL9v8PnPijhO3vGVzXobt0v/zxohh8ezLt1aJfUqbFmTE ZGvTpRbnmWn8JJ/bK0SJpTgj0VCLuag4EQCJaZ7vfwIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170315144114eucas1p115522a62b550b282bcd2df99e06be9ef X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170315144114eucas1p115522a62b550b282bcd2df99e06be9ef X-RootMTR: 20170315144114eucas1p115522a62b550b282bcd2df99e06be9ef References: <1489588870-7785-1-git-send-email-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP DECON in Exynos5433 has frame counter, it can be used to implement get_vblank_counter callback. Signed-off-by: Andrzej Hajda --- v2: - reuse decon_get_frame_count function already implemented in previous patch --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 12 ++++++++++++ drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + 3 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index c336a9b2..12f6c27 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -166,6 +166,16 @@ static u32 decon_get_frame_count(struct decon_context *ctx, bool end) return frm; } +static u32 decon_get_vblank_counter(struct exynos_drm_crtc *crtc) +{ + struct decon_context *ctx = crtc->ctx; + + if (test_bit(BIT_SUSPENDED, &ctx->flags)) + return 0; + + return decon_get_frame_count(ctx, false); +} + static void decon_setup_trigger(struct decon_context *ctx) { if (!(ctx->out_type & (IFTYPE_I80 | I80_HW_TRG))) @@ -564,6 +574,7 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = { .disable = decon_disable, .enable_vblank = decon_enable_vblank, .disable_vblank = decon_disable_vblank, + .get_vblank_counter = decon_get_vblank_counter, .atomic_begin = decon_atomic_begin, .update_plane = decon_update_plane, .disable_plane = decon_disable_plane, @@ -583,6 +594,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) ctx->drm_dev = drm_dev; ctx->pipe = priv->pipe++; + drm_dev->max_vblank_count = 0xffffffff; for (win = ctx->first_win; win < WINDOWS_NR; win++) { int tmp = (win == ctx->first_win) ? 0 : win; diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 9184974..c02378b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -142,6 +142,16 @@ static void exynos_drm_crtc_disable_vblank(struct drm_crtc *crtc) exynos_crtc->ops->disable_vblank(exynos_crtc); } +static u32 exynos_drm_crtc_get_vblank_counter(struct drm_crtc *crtc) +{ + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); + + if (exynos_crtc->ops->get_vblank_counter) + return exynos_crtc->ops->get_vblank_counter(exynos_crtc); + + return 0; +} + static const struct drm_crtc_funcs exynos_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, @@ -151,6 +161,7 @@ static const struct drm_crtc_funcs exynos_crtc_funcs = { .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .enable_vblank = exynos_drm_crtc_enable_vblank, .disable_vblank = exynos_drm_crtc_disable_vblank, + .get_vblank_counter = exynos_drm_crtc_get_vblank_counter, }; struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index cb31769..906ab7a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -133,6 +133,7 @@ struct exynos_drm_crtc_ops { void (*commit)(struct exynos_drm_crtc *crtc); int (*enable_vblank)(struct exynos_drm_crtc *crtc); void (*disable_vblank)(struct exynos_drm_crtc *crtc); + u32 (*get_vblank_counter)(struct exynos_drm_crtc *crtc); int (*atomic_check)(struct exynos_drm_crtc *crtc, struct drm_crtc_state *state); void (*atomic_begin)(struct exynos_drm_crtc *crtc);