From patchwork Fri Sep 1 07:07:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hoegeun Kwon X-Patchwork-Id: 9933603 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 9095B6021C for ; Fri, 1 Sep 2017 07:07:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82BD92853F for ; Fri, 1 Sep 2017 07:07:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7763C28575; Fri, 1 Sep 2017 07:07:30 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E3BD2853F for ; Fri, 1 Sep 2017 07:07:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5FE676E7D0; Fri, 1 Sep 2017 07:07:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9B1BA6E7D1 for ; Fri, 1 Sep 2017 07:07:27 +0000 (UTC) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20170901070725epoutp01c17bfdebc079e4e0385e02aca61b03b1~gKxUzHauI2608926089epoutp01o; Fri, 1 Sep 2017 07:07:25 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.40.66]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20170901070725epcas1p31d6dcffa9ef3976af670cf0a7bb34aab~gKxUiSlyq2359523595epcas1p3d; Fri, 1 Sep 2017 07:07:25 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 67.FC.20955.D2709A95; Fri, 1 Sep 2017 16:07:25 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20170901070725epcas1p288a5be80c3a3edb02433d24f5beed338~gKxUW6V8W0881508815epcas1p2a; Fri, 1 Sep 2017 07:07:25 +0000 (GMT) X-AuditID: b6c32a36-f79196d0000051db-bb-59a9072d003a Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 65.57.11757.C2709A95; Fri, 1 Sep 2017 16:07:25 +0900 (KST) Received: from localhost.localdomain ([10.113.63.38]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OVL00M00AGBO940@mmp1.samsung.com>; Fri, 01 Sep 2017 16:07:24 +0900 (KST) From: Hoegeun Kwon To: daniel.vetter@intel.com, jani.nikula@linux.intel.com, seanpaul@chromium.org, airlied@linux.ie Subject: [PATCH] drm/vblank: Fix delta_ns to an absolute value Date: Fri, 01 Sep 2017 16:07:16 +0900 Message-id: <1504249636-11681-1-git-send-email-hoegeun.kwon@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPKsWRmVeSWpSXmKPExsWy7bCmvq4u+8pIg8YvAha9504yWSw/s47Z 4srX92wW75d3sVksv7ye0eLyrjlsFnc3nGV0YPeY3XCRxW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73ceZ PPq2rGL0+LxJLoA9issmJTUnsyy1SN8ugStj7YT37AUvuCqaph1namB8y9HFyMkhIWAi8bxl PVsXIxeHkMBORonHSxYwQjjfGSWWz7zJClLFJqAr8bXnOhOILSKQLPFmdgsjiM0skCMx8183 mC0sYCdx+v98FhCbRUBV4tWSH2wgNq+Ah8Tf/cuYILbJSZw8Npl1AiPXAkaGVYySqQXFuem5 xUYFhnmp5XrFibnFpXnpesn5uZsYgYGy7bBW3w7G+0viDzEKcDAq8fCu4FoRKcSaWFZcmXuI UYKDWUmEN4xtZaQQb0piZVVqUX58UWlOavEhRmkOFiVx3sy+GZFCAumJJanZqakFqUUwWSYO TqkGRt09xy+enp8sHcLwaU3THMZJHea6Nl5q2wSmy3KbWa7/VmR0fumk2tB9DiLp33f4Ms47 m39wuezFvPurJPsn5G+/NfPKhoodXJYVP0OqbD83dOwO7H6dtPaBrH36xtfKe3de2tKk7Sf5 sM7W76JULE9Y1GLBiUL7qvKvyT9+u3uLggn7g//iGUosxRmJhlrMRcWJAKKSHesQAgAA X-CMS-MailID: 20170901070725epcas1p288a5be80c3a3edb02433d24f5beed338 X-Msg-Generator: CA X-Sender-IP: 182.195.42.142 X-Local-Sender: =?UTF-8?B?6raM7ZqM6re8G1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?SG9lZ2V1biBLd29uG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG1RFTEUbQzEwVjgxMTE=?= CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170901070725epcas1p288a5be80c3a3edb02433d24f5beed338 X-RootMTR: 20170901070725epcas1p288a5be80c3a3edb02433d24f5beed338 References: Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Hoegeun Kwon 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-Virus-Scanned: ClamAV using ClamSMTP If scanout started, we should reduce etime by delta_ns. But delta_ns is negative if scanout has not started. If delta_ns is negative, subtraction of delta_ns from etime increases etime. This is wrong, the etime should not be increased, so you have to make delta_ns an absolute value. Signed-off-by: Hoegeun Kwon --- Hello all, I think that the etime should not be increased. In cases where delta_ns is negative, if you get time again after an interrupt call, there is a problem that the time obtained from the interrupt becomes the future time instead of the past time. Please let me know if this patch is wrong. Best regards, Hoegeun drivers/gpu/drm/drm_vblank.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 70f2b95..a3e0176 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -684,7 +684,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, /* Subtract time delta from raw timestamp to get final * vblank_time timestamp for end of vblank. */ - etime = ktime_sub_ns(etime, delta_ns); + etime = ktime_sub_ns(etime, abs(delta_ns)); *vblank_time = ktime_to_timeval(etime); DRM_DEBUG_VBL("crtc %u : v p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n",