From patchwork Wed Mar 8 14:58:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9611415 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 2D51B60414 for ; Wed, 8 Mar 2017 15:13:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D998227DA4 for ; Wed, 8 Mar 2017 15:13:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE50F285E8; Wed, 8 Mar 2017 15:13:08 +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 6334627DA4 for ; Wed, 8 Mar 2017 15:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751632AbdCHPMr (ORCPT ); Wed, 8 Mar 2017 10:12:47 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:8390 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbdCHPMo (ORCPT ); Wed, 8 Mar 2017 10:12:44 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OMI00D944AG95A0@mailout4.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 08 Mar 2017 14:59:04 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170308145903eucas1p1ad2098d9e3b5ef2535dc720cbbda7543~p8BljNKGG1923119231eucas1p1Q; Wed, 8 Mar 2017 14:59:03 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 0D.0A.16908.A3C10C85; Wed, 8 Mar 2017 14:59:06 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170308145902eucas1p131a3e6700da4e72c6d4ca1a4f74e5893~p8Bko0USo0819608196eucas1p1E; Wed, 8 Mar 2017 14:59:02 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-bd-58c01c3a4f41 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id DF.B7.10233.14C10C85; Wed, 8 Mar 2017 14:59:13 +0000 (GMT) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OMI0059P4AC5T30@eusync3.samsung.com>; Wed, 08 Mar 2017 14:59:02 +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 v2 04/12] drm/exynos/decon5433: implement frame counter Date: Wed, 08 Mar 2017 15:58:38 +0100 Message-id: <1488985126-25288-5-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1488985126-25288-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsWy7djPc7pWMgciDKYdZ7e4te4cq8XGGetZ La58fc9mMen+BBaLN2/X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kBE4meCS3MELaYxIV769m6GLk4 hASWMEpMa73KAuE0MklsuHWZFaSKTUBT4u/mm2wgtoiAssSqfe3sIEXMAhuYJO72nQQrEhZw lzhyYSkLiM0ioCrROH0qWJxXwFmibdUuRoh1chI3z3WCreYUcJHo+zgZyOYA2uYssbRfZwIj 7wJGhlWMIqmlxbnpucVGesWJucWleel6yfm5mxiBQb3t2M8tOxi73gUfYhTgYFTi4d0hcCBC iDWxrLgy9xCjBAezkgjvha/7I4R4UxIrq1KL8uOLSnNSiw8xmgLdNJFZSjQ5HxhxeSXxhiaG 5paGRsYWFuZGRkrivFM/XAkXEkhPLEnNTk0tSC2C6WPi4JRqYNTIN1Gdwv2Jf5EJ+5o9JunP p5351ONW3DLjj55Pksga22d2kyoucxsn+k7pcLjm+KgnJroyWs2tf3rtykD9xUJrO3YeZP0v z3L05Kn0SZFb4vSLZT8eqZQKXruwyr8jbldIcypT2Hc7vpkzVUOX5Xo3/t3y0jGw0HHazLkH pE0u+K/hTdV8qsRSnJFoqMVcVJwIAHnIR1yAAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170308145902eucas1p131a3e6700da4e72c6d4ca1a4f74e5893 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 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: 20170308145902eucas1p131a3e6700da4e72c6d4ca1a4f74e5893 X-RootMTR: 20170308145902eucas1p131a3e6700da4e72c6d4ca1a4f74e5893 References: <1488985126-25288-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 4ca3d6e..60ff81b 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);