Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp830677imm; Wed, 26 Sep 2018 07:27:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV62FM+kyrn838iOVVtM4MXS8tiDJWv1tPqm54j9weyPqQo2h1G5QBf8ZqxU5TgbjR1F5TAp7 X-Received: by 2002:a63:5c5d:: with SMTP id n29-v6mr6053274pgm.253.1537972047262; Wed, 26 Sep 2018 07:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537972047; cv=none; d=google.com; s=arc-20160816; b=BTcz8l3a6W1v2zDskjq09d289FBReYBMf01uBj7BwrETrxXKHvnsKnstVcnkL4OcQF 5vHakVDuoq7mOXL2r63v4U/fGDUi9RMhsbATDPJtufg6UA5bF8zKryhTto0EDKwQvPEz C63+xq5/8KIGzmbelGkvrB1pBT1krFu6RrwqIRdYZCbx8i2w6Gj7MXLbU5uGNzbOhbUO ygFeFAF8duXY03UCRFPbaSk75kpl3y4ByuSfRXFgXE5VnJaPV7UUb+5NrrkEH+XnhjQJ HPfLs89Phkyu37l+Lq4EbMExYUWqNviCTsntr91TjldkzFqa4gjSsHw928mVbAqGOWvx xKig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=dQIokriCO94McgYTigtousHW07qLwINK2c8N1eRdp2g=; b=xqdW1bip01xgI2ucq3bWs2UZI3LJdkDAYtiGowLFU5RuyZcIKZCLwl8o9Vs0YRoMH9 fvE0u6uohCG6HfErlqMHbPL1ffytO9dquKM9Gf0H9GH2wqzMFxYExEfxpQxC0oIkqPCs OhSoq5Wmfp3F6q0UzydTnTR7SC9pDpmdA7TcSdFdXoZ1nPBkNvhUUB7h/UjCO2RntS26 7jUm45e7vp3Rr9JTapO7Y6A6YkbKvoR+GHicfelKQFJ84GU2wUhPLkspSDYFnybybFBv Svi/zYn43EMyQ0DWKulAp1AALYKKkMtZAV0ZuOVJkAu7reI8KXN1d3zPvcQmwFxSo2k+ YytQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=NitFmy3j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8-v6si5384839pgu.519.2018.09.26.07.27.11; Wed, 26 Sep 2018 07:27:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=NitFmy3j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727692AbeIZUi6 (ORCPT + 99 others); Wed, 26 Sep 2018 16:38:58 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:44060 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726994AbeIZUi6 (ORCPT ); Wed, 26 Sep 2018 16:38:58 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id CFC1F24E238D; Wed, 26 Sep 2018 07:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1537971945; bh=ReVafM3t9npTlHFTc12wOnkxcS9D2M+4a44nR9nLSDM=; h=From:To:Cc:Subject:Date:From; b=NitFmy3jAZua4yQnmew77fgKsWhWUPq/JJBMjRELx/dRPAulu43+UqfHEmWmEGTvD /gI4LpxyAlq+nIQnLY3AmOQbn7nGZPDsaMt+eQs1UgmR16FJG6tD27o7J0vPwndhNj qamcmd0widoWSUVs978U+sCqqrxczxqhBUHzlBkK6oHa291UQJ9PL75y6HOj68Aq3V uN9L7CY/R7gWZkRyOJkyJIdfcJkgk9LfVGbo5+raQfnFFf/pT5nIiBuITtez69obDc NqdM2/XNx4JGqrAlsZSk6BI5MoZ1tJ0dqHXVE1mHH9MD7EmT+3PRgFEdzJ1RGfTgAB rvDIKT3i1Oa9A== Received: from paltsev-e7480.internal.synopsys.com (paltsev-e7480.internal.synopsys.com [10.121.3.38]) by mailhost.synopsys.com (Postfix) with ESMTP id 8155E5CD0; Wed, 26 Sep 2018 07:25:38 -0700 (PDT) From: Eugeniy Paltsev To: dri-devel@lists.freedesktop.org Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, Gustavo Padovan , Maarten Lankhorst , Sean Paul , David Airlie , Alexey Brodkin , stable@vger.kernel.org, Eugeniy Paltsev Subject: [PATCH] DRM: VBLANK: provide valid timestamp for EVENT_FLIP Date: Wed, 26 Sep 2018 17:25:35 +0300 Message-Id: <20180926142535.17997-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.14.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If driver/HW doesn't support vblank functionality (for example UDL driver, ARCPGU driver, ...) we always have vblank->time == 0. In result we always provide zero timestamp for DRM_EVENT_FLIP_COMPLETE. This breaks userspace apps (for example weston) which relies on timestamp value. Setup time to provide valid timestamp for DRM_EVENT_FLIP_COMPLETE event. Cc: stable@vger.kernel.org Signed-off-by: Eugeniy Paltsev --- drivers/gpu/drm/drm_vblank.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c index 28cdcf76b6f9..0d19aca48782 100644 --- a/drivers/gpu/drm/drm_vblank.c +++ b/drivers/gpu/drm/drm_vblank.c @@ -911,6 +911,15 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc, if (dev->num_crtcs > 0) { seq = drm_vblank_count_and_time(dev, pipe, &now); + + /* + * If driver/HW doesn't support vblank functionality we + * always have vblank->time == 0. Setup time to provide valid + * timestamp for DRM_EVENT_FLIP_COMPLETE event. + */ + if (!now && e->event.base.type == DRM_EVENT_FLIP_COMPLETE) + now = ktime_get(); + } else { seq = 0; -- 2.14.4