From patchwork Tue Jul 19 18:59:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 9238147 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 23702600CB for ; Tue, 19 Jul 2016 18:59:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 117DA26A4D for ; Tue, 19 Jul 2016 18:59:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0655B26E81; Tue, 19 Jul 2016 18:59:56 +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.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9246C26A4D for ; Tue, 19 Jul 2016 18:59:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AD596E024; Tue, 19 Jul 2016 18:59:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id B521E6E024 for ; Tue, 19 Jul 2016 18:59:43 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id q128so3835714wma.1 for ; Tue, 19 Jul 2016 11:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=09r0fL1Tc7nhoAcgyOOExBHSqFwL7LcYBm/b7clYYN0=; b=01Elf+xlOGytOEuJq7i3BEQ/Jtuwf929yvM1TnKe0i0bCQasFfIfj3YawnhRwEECUT Du2EiDQeRARhS6NuSq4u6yIaeWxRijDKleonLcvhIRs2SNqHcThEnvwefSJZlW4bY2ah Uhh8RtaD2vq1uk45vjjbF7nOtFvxoVMhKHHUegQAYTD9/GRFMYYJC3ucHHg2NftPsuP6 OmbFngSCapHbtGvgdRy8puwJQbIbsEIZRyfmf9qfqOo9BrPgNsfwtSx9ZtvdCAR+Rb+1 yaN8TEGOTfh4C7GTYnFef4RYNBhhrPv3MCf8K0stw19WzrLG0hgeoNpgio7b8rbsoIm+ extg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=09r0fL1Tc7nhoAcgyOOExBHSqFwL7LcYBm/b7clYYN0=; b=MZY1sGfv3ru1vHsDko7LJg0XSTdtCSeOTMeX9bec8SRsDgSn50VKTjFko3HjWdFAuZ iro3p8Qa5+6iOlZaiEQnbDs6WDHJCa01DqYYGw90d3ELa1u0oSc5rGijLS96ptA0rYTq oWU81hlpP8dBjh6cyOvX32ifT+BVacUR7Kzpp3CzHRBi3Jv3rCoQoK0p2JyhQSUIizoY ZXeLqAB5UhlJvH+ZuP9MBmQXE8l2ViupxX33juTa8PeFbyT+yeRWASCKLun1w5nvn2ps i8+zlw19Zb+ZkKFbojD+lgs0fWf8TJP3oV76I8L8LFf7pOLzQejsSFWRREEd08yMzn5R 2DSQ== X-Gm-Message-State: ALyK8tLW69HeIvs+ygzKHp5uI5okSswUzYGEC8z3r+oRAoh/WwUVkB4qZMh8LKvPMA3Phw== X-Received: by 10.28.26.69 with SMTP id a66mr5888669wma.8.1468954781029; Tue, 19 Jul 2016 11:59:41 -0700 (PDT) Received: from twisty.fritz.box (x4d02e19a.dyn.telefonica.de. [77.2.225.154]) by smtp.gmail.com with ESMTPSA id i8sm7755380wmg.21.2016.07.19.11.59.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 11:59:40 -0700 (PDT) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/5] drm/vc4: Enable/Disable vblanks properly in crtc en/disable. Date: Tue, 19 Jul 2016 20:59:01 +0200 Message-Id: <1468954741-30993-6-git-send-email-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1468954741-30993-1-git-send-email-mario.kleiner.de@gmail.com> References: <1468954741-30993-1-git-send-email-mario.kleiner.de@gmail.com> 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 Add missing drm_crtc_vblank_on/off() calls so vblank irq handling/updating/timestamping never runs with a crtc shut down or during its shutdown/startup, as that causes large jumps in vblank count and trouble for compositors. Signed-off-by: Mario Kleiner Cc: Eric Anholt --- drivers/gpu/drm/vc4/vc4_crtc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 7ffdad5..2682f07 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -475,6 +475,9 @@ static void vc4_crtc_disable(struct drm_crtc *crtc) int ret; require_hvs_enabled(dev); + /* Disable vblank irq handling before crtc is disabled. */ + drm_crtc_vblank_off(crtc); + CRTC_WRITE(PV_V_CONTROL, CRTC_READ(PV_V_CONTROL) & ~PV_VCONTROL_VIDEN); ret = wait_for(!(CRTC_READ(PV_V_CONTROL) & PV_VCONTROL_VIDEN), 1); @@ -525,6 +528,9 @@ static void vc4_crtc_enable(struct drm_crtc *crtc) /* Turn on the pixel valve, which will emit the vstart signal. */ CRTC_WRITE(PV_V_CONTROL, CRTC_READ(PV_V_CONTROL) | PV_VCONTROL_VIDEN); + + /* Enable vblank irq handling after crtc is started. */ + drm_crtc_vblank_on(crtc); } static bool vc4_crtc_mode_fixup(struct drm_crtc *crtc,