Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1047628ybm; Wed, 27 May 2020 14:51:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYEGGhNptLE8SURvLaoH5bDMP+342UOuWBc8XFVO5dd1QzHL9bZibeKFyLxg+uUTIckEKG X-Received: by 2002:a17:907:10c2:: with SMTP id rv2mr301910ejb.309.1590616291209; Wed, 27 May 2020 14:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590616291; cv=none; d=google.com; s=arc-20160816; b=K/YdzCOftgXe+zkefb8isuRZcclI3oeVp/IjGv8/Xfu9EtJu/1xV25ChTVmF6lfGIY kYXSNmwY1Vzi/aVFRJnqMrwPXQ7s3BpaQREBzeZ6M4jgFFYlxTkLLHlh4bGgcOQjWodR NLNfXCgyB+t/02eTMBEzrCdymkJdf+UrfmE46iPD7tBMOKiRuVm2j2AsuowQrKDOEL8D 20vZfK1qUVKz+00fhLv3Ic6ytq+1KPt6s6FgdMjwx1tsO3PtX8NBuHvKbrFX+f3w1OGZ KWxJ54bDFbhbggZzE7OrhMm0PDiM5Oz0oMK6bwKUudcc+/VmOKO8pxrnEyoE05bnLxnu st+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=JGXVhoFW91mN2E2QU0GxY5mdDUGcUQsnXqVzXlG9svM=; b=cuMQWC1ft6JNJBxlSPyJUap1ID4fbGlnseYDTDXeO3O5MYJ1YWKGK9aDGaNEFRTOGf mk8UT8+gF0+Phxz0v3HU/ESm7qyLX7ZszARk8b2oIDyzCntdWAj/dazs0GCMpJP8ssxu DgSM8s6yfeSEu1ewn4TnyL1yw6/gbfYXXLRrwwCkZtqudetmC0WyFqU0o2jfQZ4zC2x9 8PKVvIB0wPafIBp0sj3H2BFeirummQhe9nJxIMOG4M/manZ4kNS1zwqGts422PMTS2eL EQ4awQ9DnbFHBaLkkp/sF/ecpzm/3XYNnyEbBb1AblU6baVJeK2YbQwKDuGKX6uDwby5 WMVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=urxn0u51; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VwhFURFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx3si2500786edb.547.2020.05.27.14.51.08; Wed, 27 May 2020 14:51:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=urxn0u51; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VwhFURFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390520AbgE0PyL (ORCPT + 98 others); Wed, 27 May 2020 11:54:11 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:39049 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390235AbgE0Pvx (ORCPT ); Wed, 27 May 2020 11:51:53 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id D047F582114; Wed, 27 May 2020 11:51:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 27 May 2020 11:51:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=JGXVhoFW91mN2 E2QU0GxY5mdDUGcUQsnXqVzXlG9svM=; b=urxn0u51Ux8czLhE+NeHV6kmhzgfy BZKQsRT3bQySq56Ug7ov0q2ni5pNK0VpQuw4q2tOfPTKO++1yRQWdhzgpT0MIqfg C/im6hdEbtq4X6Zw3BKcEHv0p0SAVvp6JTk6I0Z8bKp2L75kzc2SP2EzqjCsd1Nx JFkYhxncwr18lmOXHcxnz4tR449qb874yKzcLJsKB7O9SC0fUSG9mdgiFG0eEJe0 lZwNoZlKO7LvegDomkEwtstdSQaHciv8rBnmJmu1k0hDia1sT1dpceRiiTvAGvz1 GID2DE2ixQi/HzIezTH8aV/4hoxvzJj15751tDKluD46IvvqWLgwnQQTA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=JGXVhoFW91mN2E2QU0GxY5mdDUGcUQsnXqVzXlG9svM=; b=VwhFURFS 0+vRS3dXHtl9/MQLYZYf6vUD5og+Z08aGTxFxOkcKiscJzCOTOGsjtcI2JqqHl4N r9qH3JxFjpas61XpaQkjPLfyotSPfLVen+TJwkwOV9R24UCyQYcKU4ZkKsuHoXDe GdaPEtc/T2o8/mQIWFnlSjtb3A+wZ2GDQSiLWHmp4DxwZmIpDex2Iniu+Zwe9J5g 8T7S9g+v8ZK6Jaid4+6HdLgXjjz4G09c1jwEkkpWBDFHu/H7zRhboGhoe2szcWNy pCF9GIev9a7ovdyL44M3QbfytvMvdrZ5GYQg4T+qxL8WLcLZxuhBs1/NhRlySp/v oUzhP0yvwghwsg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvgedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepjeehne curfgrrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 835B830624CC; Wed, 27 May 2020 11:51:52 -0400 (EDT) From: Maxime Ripard To: Nicolas Saenz Julienne , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell , Maxime Ripard Subject: [PATCH v3 099/105] drm/vc4: hdmi: Always recenter the HDMI FIFO Date: Wed, 27 May 2020 17:49:09 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to avoid a pixel getting stuck in an unflushable FIFO, we need to recenter the FIFO every time we're doing a modeset and not only if we're connected to an HDMI monitor. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 46 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 4b23d589377a..a97f378c6d2d 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -425,6 +425,30 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, (hsync_pos ? 0 : VC4_HD_VID_CTL_HSYNC_LOW)); } +static void vc4_hdmi_recenter_fifo(struct vc4_hdmi *vc4_hdmi) +{ + u32 drift; + int ret; + + drift = HDMI_READ(HDMI_FIFO_CTL); + drift &= VC4_HDMI_FIFO_VALID_WRITE_MASK; + + HDMI_WRITE(HDMI_FIFO_CTL, + drift & ~VC4_HDMI_FIFO_CTL_RECENTER); + HDMI_WRITE(HDMI_FIFO_CTL, + drift | VC4_HDMI_FIFO_CTL_RECENTER); + usleep_range(1000, 1100); + HDMI_WRITE(HDMI_FIFO_CTL, + drift & ~VC4_HDMI_FIFO_CTL_RECENTER); + HDMI_WRITE(HDMI_FIFO_CTL, + drift | VC4_HDMI_FIFO_CTL_RECENTER); + + ret = wait_for(HDMI_READ(HDMI_FIFO_CTL) & + VC4_HDMI_FIFO_CTL_RECENTER_DONE, 1); + WARN_ONCE(ret, "Timeout waiting for " + "VC4_HDMI_FIFO_CTL_RECENTER_DONE"); +} + static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) { struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; @@ -543,8 +567,6 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) } if (vc4_encoder->hdmi_monitor) { - u32 drift; - WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) & VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE)); HDMI_WRITE(HDMI_SCHEDULER_CONTROL, @@ -555,25 +577,9 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) VC4_HDMI_RAM_PACKET_ENABLE); vc4_hdmi_set_infoframes(encoder); - - drift = HDMI_READ(HDMI_FIFO_CTL); - drift &= VC4_HDMI_FIFO_VALID_WRITE_MASK; - - HDMI_WRITE(HDMI_FIFO_CTL, - drift & ~VC4_HDMI_FIFO_CTL_RECENTER); - HDMI_WRITE(HDMI_FIFO_CTL, - drift | VC4_HDMI_FIFO_CTL_RECENTER); - usleep_range(1000, 1100); - HDMI_WRITE(HDMI_FIFO_CTL, - drift & ~VC4_HDMI_FIFO_CTL_RECENTER); - HDMI_WRITE(HDMI_FIFO_CTL, - drift | VC4_HDMI_FIFO_CTL_RECENTER); - - ret = wait_for(HDMI_READ(HDMI_FIFO_CTL) & - VC4_HDMI_FIFO_CTL_RECENTER_DONE, 1); - WARN_ONCE(ret, "Timeout waiting for " - "VC4_HDMI_FIFO_CTL_RECENTER_DONE"); } + + vc4_hdmi_recenter_fifo(vc4_hdmi); } static enum drm_mode_status -- git-series 0.9.1