Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp752363ybt; Wed, 8 Jul 2020 10:46:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwMecukuWtKLDIGXfw0Cy8QGgbBV/4OOP+qWmTFUiqyneiEPj5uwkdXpkJENfOkL9zAlkt X-Received: by 2002:a17:906:c53:: with SMTP id t19mr55579659ejf.143.1594230369971; Wed, 08 Jul 2020 10:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594230369; cv=none; d=google.com; s=arc-20160816; b=cuhhyVcdyEcpI4UCQ3lmVzFN/sMU0gkvRZhowgIw+GhqcSoE34cYLEP8AQuZ/6glUz 14mGXgNLknfm9TvRQoBNkmx/+NXJPGTpoKBj9o8MHtnbpciC5tHAGGWv1BMxFEQa6IrJ 6CwaAu5RLQ8HJoVbRdDCExNgWj9IRMuhZMnkDzeqcyuho3AqsjffjG/bsMLPxWvd4IEK R7CaVTiIggyRfb2xOovlI3VoS7piQJz9RFd4nDNUEeMjInDUxX4oqxxvKBv1RHR6j9px kpYGMLYcj4m4ULA6PuK0A1FpxhjprtU7UrOTL7Jf234s3PkEfZ88JfA89xKPhLiNgRSb FSKg== 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=xdl2eLghVNafTUt0e6LydxebMrJ4MDHKK656BcDDsp4=; b=qtuCgKCbpaR6n0YsL97MS/KEQ/B8pheyvAfwSrEz0xCtkTPitR6jZ2fvOHu5cpW3J9 omHGhwvZHcgIPukjef0LeZ1p6UFGQEBFuCoDVPIIito9DzgOqs3FZ7gYI4Y2+iAJQSi7 jf6euhgTeGCNbc8nfx2Zo/8GC/QzXdmdC7IbVnC0A1FIWU43vcId59BhZXhF0tTRL3Dj uyd3tXVW0WzNDwqimdYuuBEs/CjXx09puBtoDT4Rw7BIEu8osjcOM26KNx4nz3df4vwn bjgdfBByhwd7KrvdXMImnTPgN/o5rXZ02CZ5MtuIilf7wKvl6G4bjoWDhwFsShWMiuFF hQeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=dWtICfbT; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=bKkVdE06; 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 c25si396747edw.141.2020.07.08.10.45.47; Wed, 08 Jul 2020 10:46:09 -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=fm3 header.b=dWtICfbT; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=bKkVdE06; 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 S1728219AbgGHRot (ORCPT + 99 others); Wed, 8 Jul 2020 13:44:49 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:34323 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728031AbgGHRoN (ORCPT ); Wed, 8 Jul 2020 13:44:13 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 9201A333; Wed, 8 Jul 2020 13:44:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 08 Jul 2020 13:44:13 -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=fm3; bh=xdl2eLghVNafT Ut0e6LydxebMrJ4MDHKK656BcDDsp4=; b=dWtICfbTZHOne+h/JQzxnBLKVsjeQ bKDesKRYnha6ox+JhczGcRGYnXjapL77jv+6ANkn5q5tFFp6PardO3k0jDkiP1+Z 78gHX5fGzTvcyZItCDPmW+O2loMZ4hKAfp6JPC2loDPs7ErgbA16ID1qI5HJaceR Ou9VREbHwTYzB0tJmBmt5++9gfMwp6/SbBwhL8phPcSwreCLF3wJNfn8nf638wDo PDjPctkoy/EKF+TIZp91dK7o+xZsLCxpwxMiu18N+HGDz23qKcQ0AlYK9bbJgzDw nzar+akvQ5ZGJdQbTCf/fP5005burcxfBw4/zZKCzzH3GRcVZH20JET5g== 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= fm3; bh=xdl2eLghVNafTUt0e6LydxebMrJ4MDHKK656BcDDsp4=; b=bKkVdE06 D9/V428o+6LsuZL3sh4L2N4yBbBl8ZHmVpp6uEmfwlHmagJCjOvBQABgy8xoU2Dl GY2qEjiHfCpLjhla6Z4iDzwbRSXcE0rn+QCXWj8U7wuYXCdKmg7Q6cqrf3B7LaaE JDjL75mIFi23H8nFDhTeFiezSQwDL2B9uLPoO8HO96TAiSxb/lqMEY66wCwbfQO5 bQ1/HAKpp9i6ugS4vglB1KsW7ExKW1RnJyEsggg0+WaOYhSzd2QUGi5QOX9B6IhL GgBoeLsNuPdACqq6nvkbP30yP2EG/T4N/AQ4sWwYVnzRA0EPpkz//oPrqZQN9ula R2kfKnX0D8cwWQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudejgdduudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepieeine 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 CF62A328005E; Wed, 8 Jul 2020 13:44:11 -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 v4 70/78] drm/vc4: hdmi: Always recenter the HDMI FIFO Date: Wed, 8 Jul 2020 19:42:18 +0200 Message-Id: <12499869afccd632b222eec328a6352111472986.1594230107.git-series.maxime@cerno.tech> 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 4058985940e6..00592c1ada73 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