Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4035597ybd; Tue, 25 Jun 2019 12:52:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpPcsbLQMoMNN23LZnsFNsjrZYwL7cUYxPqWVJjp4mZfoi+cQB5Bi4sA9cWqctbXxZQ7mM X-Received: by 2002:a17:90a:5884:: with SMTP id j4mr661805pji.142.1561492366972; Tue, 25 Jun 2019 12:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561492366; cv=none; d=google.com; s=arc-20160816; b=OIt75O8MoRexv/wFdwu8AUqoPMy5aQZE02aFWdbtHxhPeZO7CA40SAv+63CcGOt9Wg We5Tl/hSPiLKT/6niryPBJrXK/2cT1NBs7+OBwCZEZ8DmphDQ48g6NASV42wDe/5Tq3P RIVA7SmyT2f+wCDkXxvE9iu0kgzywsWraMx6k/R6ItbANkzLa6EWVQLDbT3wI366C7j2 DD/s2i5H3oYy3LikrysdbMnDH01zQp3Pucdtvk526SBwnH+V89oM9Bst5ksLFdRQsUBT tgZni7RM5ZQbjU6s5zFXvd/9v7g72Cgxq6hrwt28ZrUqvNPCRvv6W311BzQWCCJjqITM o4cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=AY5elSNDVUjNe5ga3YWntIz4a2Lye+h7+qUQY3nn6iA=; b=jcjb+DYVPt4uqRWVnhGeifqcx1OcnFE/lz7FSKwGwg3jwLlNMLC4/Cf3kzUML2R2Ie RpwBMr1jDhpnSHeqaHuq+AUaDm5IhYoHZFoxIHPzUdmkIdRJCROPK47eSFfBma7C9rzW 3Vh4ZnXz+nw+MNxdfO1aPNeVBIgJ3Jx4FFZtetW8JoalE+mtZxwoktyfIuwNoWJoRViS gITjFrzz/VCiQxTFsR15Fx6E/KyFyJeNMYFjUKg17fyEuFgTAnLptIBBxZzbkFTSFvp3 Xc/ke+ICEoqJa8wnGmN14kT7Zzm2veWXpi3HbH0yCQh2KcU1e6vjDDxprzKX5PqSfNEI BQxw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b20si9845792pfo.108.2019.06.25.12.52.31; Tue, 25 Jun 2019 12:52:46 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732816AbfFYSCt (ORCPT + 99 others); Tue, 25 Jun 2019 14:02:49 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58790 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727385AbfFYSCj (ORCPT ); Tue, 25 Jun 2019 14:02:39 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: bbeckett) with ESMTPSA id 2ECC328626E From: Robert Beckett To: dri-devel@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Robert Beckett Subject: [PATCH v3 2/4] drm/imx: notify drm core before sending event during crtc disable Date: Tue, 25 Jun 2019 18:59:13 +0100 Message-Id: <066eb916ec920e0515367548e4af2ee28f9d0a43.1561483965.git.bob.beckett@collabora.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Notify drm core before sending pending events during crtc disable. This fixes the first event after disable having an old stale timestamp by having drm_crtc_vblank_off update the timestamp to now. This was seen while debugging weston log message: Warning: computed repaint delay is insane: -8212 msec This occured due to: 1. driver starts up 2. fbcon comes along and restores fbdev, enabling vblank 3. vblank_disable_fn fires via timer disabling vblank, keeping vblank seq number and time set at current value (some time later) 4. weston starts and does a modeset 5. atomic commit disables crtc while it does the modeset 6. ipu_crtc_atomic_disable sends vblank with old seq number and time Fixes: a474478642d5 ("drm/imx: fix crtc vblank state regression") Signed-off-by: Robert Beckett --- drivers/gpu/drm/imx/ipuv3-crtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index 9cc1d678674f..e04d6efff1b5 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c @@ -91,14 +91,14 @@ static void ipu_crtc_atomic_disable(struct drm_crtc *crtc, ipu_dc_disable(ipu); ipu_prg_disable(ipu); + drm_crtc_vblank_off(crtc); + spin_lock_irq(&crtc->dev->event_lock); if (crtc->state->event) { drm_crtc_send_vblank_event(crtc, crtc->state->event); crtc->state->event = NULL; } spin_unlock_irq(&crtc->dev->event_lock); - - drm_crtc_vblank_off(crtc); } static void imx_drm_crtc_reset(struct drm_crtc *crtc) -- 2.18.0