Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp369311ybg; Tue, 28 Jul 2020 08:05:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwySbAnMhyh/aFb1uLPBDA4f9eLnWZMXEqKMR/P62EySoDkOC7fiPDZ8BjKvy413uznB+Hk X-Received: by 2002:a17:906:4056:: with SMTP id y22mr12031754ejj.504.1595948741254; Tue, 28 Jul 2020 08:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595948741; cv=none; d=google.com; s=arc-20160816; b=NPl+XGepGuhog0f1y75NcIK874K5C1azWw9Ie2m5r9qSuJucoTipRjLgU7fMCCbmFy otxyEQcBHaLhQBFUk+ddPfnSSyqWTVa4ai2YbuTPpDwbL8svmzS+Ood/YljYXWnaWUum hcmnyGDQJFx2qB9qKRCbmdUhr6ySsCdS1/TJMyPgsVTEkvIQx6SarO/wy7VMh3Hh05uc T7j2Rla2zDdBWMvQvSDNYNIs4/StoIrgINyMPS0IPDco/HFmO1/5se6L6XF11hVHlmfl E8ccRnfnF4EHhLSHyPPpAbzcX5br97yXkuzEm1haTP3Cz8+I3FD1DTQBprVsnbw+klvx PKFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DtL8cvtGkTaSwrDEo6k42OsH604F6vO5Vz2A8YHvbY0=; b=hue1lYcqKepAQe+PA2nOy6HBP2HsDD11vLetsD5Ap/ryQOlNW0J462L68Ji+JIisQs BA8TgPvPV/ADgkxBs8P+FlMG41J3TuIoCEpxaTB2cV5Penf/RQTdtEmvHW1CJGVGer5S vRcHYlNwCDK/owvzky9MjFzveTkencZpy1wBJ/q7dDlHziNzhRSCgeIri5Tml1L4/p6+ FQDBppzcLAcUYrJZPXmtpo+YAuuFs1l60s350qg0y6cy0q5TtEZmkQ35/qmEsUfPb+lr RosLTNR2cdYWZuPh3RB8CGmjTTWrURlq6EoBtOk247NF2ZxAPLEx3sFdwOdL9fZ8MDFf PpmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=hP8vsKKe; 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=raspberrypi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ss20si7371843ejb.700.2020.07.28.08.05.11; Tue, 28 Jul 2020 08:05:41 -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=@raspberrypi.com header.s=google header.b=hP8vsKKe; 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=raspberrypi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730592AbgG1PD0 (ORCPT + 99 others); Tue, 28 Jul 2020 11:03:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730518AbgG1PDZ (ORCPT ); Tue, 28 Jul 2020 11:03:25 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E61C061794 for ; Tue, 28 Jul 2020 08:03:25 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id z18so15066742wrm.12 for ; Tue, 28 Jul 2020 08:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DtL8cvtGkTaSwrDEo6k42OsH604F6vO5Vz2A8YHvbY0=; b=hP8vsKKec9YLR2W8CGgLTYGKA8sdZ4RxnBJQkHDsbPl2+gFpJ7h5Xi2unxRqQ8shA3 owPmJ/S3v/1TLjQ3qN/DTf27uH3u1CAWl0907z2yfwETuyMlYYNcv2eDKOySGn66zwyQ mX+E2fYeqgs89ToGesm8NC4ntvo9YrhrI5cXmSR3fBL2zq/ez2tay/ByKBEc7Ri74dZc 5KDyExhpUPDPdVxhaukoFQ+r0GaDRTi98myBRjPgdsEYeuWZMYKKiYp+Uwpc1EuM5HCD XCMQaOWzub3ePwPr9UA4oBzmZCYovmxd/dIXwRzV+pIptUk/dqv2ubJ8drc4OiA1kN7P Wj3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DtL8cvtGkTaSwrDEo6k42OsH604F6vO5Vz2A8YHvbY0=; b=cs1UBt5BIUC+htQrDXZLC879+amzV24QETnIqT2AGNUkM0oeMEbAzu+4dVsiKzM+aa NCi7SVhqRopyW+TeFjbw+UoH2gxG2rigROnDOWD+ajZvE0bB5srksDsBCKlCjCh3Q2jg cxLnlbGWMsbYM8Jp1nGBoo44vgOSMPrqOfy6tLMXyOaXI9tjoTitOawmuCOfN65J+h60 /Gp7PKRaNc1ZMXyujCUX8AQsq65n/rGr/lD4WG7cgcQHtSnYNQBjqaur6g8FY8OV7Ob9 gbjSUTT5hrs1SpAgh5J/GOFWNzi0dkaCRgyr7CBethn4xa6wtg6rG+z7qPyKQHFenn5T /JrA== X-Gm-Message-State: AOAM530nJ6NNK5znoDduDZqCzfsfD73Gw3OHpaCuPE+YaEz9LM52nYkv b/MicpRcDD5gFpUBsU/cRFr+KON+9Py9Hn9fHCPeHNSouME= X-Received: by 2002:adf:fe50:: with SMTP id m16mr7990761wrs.27.1595948604162; Tue, 28 Jul 2020 08:03:24 -0700 (PDT) MIME-Version: 1.0 References: <12499869afccd632b222eec328a6352111472986.1594230107.git-series.maxime@cerno.tech> In-Reply-To: <12499869afccd632b222eec328a6352111472986.1594230107.git-series.maxime@cerno.tech> From: Dave Stevenson Date: Tue, 28 Jul 2020 16:03:04 +0100 Message-ID: Subject: Re: [PATCH v4 70/78] drm/vc4: hdmi: Always recenter the HDMI FIFO To: Maxime Ripard Cc: Nicolas Saenz Julienne , Eric Anholt , DRI Development , linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, LKML , Tim Gover , Phil Elwell Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maxime On Wed, 8 Jul 2020 at 18:44, Maxime Ripard wrote: > > 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 Reviewed-by: Dave Stevenson > --- > 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