Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp954971ybm; Wed, 27 May 2020 12:05:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1f2xOMD8sLWC7QMcKluUkDkfpkigBUZce5XdQmLlTJ/5iukwMIAWJ/iQnQnPD/S1mWDVG X-Received: by 2002:a05:6402:14d5:: with SMTP id f21mr25607213edx.327.1590606358200; Wed, 27 May 2020 12:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590606358; cv=none; d=google.com; s=arc-20160816; b=Ik5aC5GX+ushRc8qw8jJ5yRKOiu9jf0+Rz/N6Heezi5NsUK9IyVwtSI+iNrUG1GDv9 +g/cMylMn5+S2B91KheJ4aWWKhGtGmzpuMx/eQhOQmKY0xV9u4GgLmRWapXt5LkUaLgQ osTUjd80zNJe1namercLAc07zVcnReiB1w5oodzl53wMpTxIdJTtEcxPG8JLzHelYsxI uki5SAxoMPM1rhJTdSFQF+TxKE1kOH/1ut7mCsJxdAYtCf95YcWbUL2lzsZybVLSFxL0 MLrcigMXZy+Z5bYxC/y9zSVD3mMKMtnbo+IDbCjhl22JP4FRu8nxoL2kYB0lfDQSO+w5 UsuQ== 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=5LdLUQabqGwWbiAk4R0m424dN93YdWZ308LsyWjEzJ4=; b=AfTzhzj7PB8WRyFId7Ie9Avw6i4ehvp58tVa0QrYx9xSZhPm4eqYhm09Ob7cnjHvFm MQuv3h57q2MZ116a4wAfDWIwYOJzNBDLJVZ9tfMP6nf0MfaYklusYSiCNcMrlcAY4io8 roo+4Yxmx6Qt5Iec9rb48UniAvKGUN00AQbU7uAhs4HT8kiGY3PtFWLyUkAIcm9JdwSc +kFEzDGmyDl4byaT6/Uz/ChtCozpk55UURjxMRsfEjHy/z+WUw5FfnzCOOLrt5LEyI/B FXhURYQscJQ/wLV/KwLtESTtm3jlnyhsWgI37sVREL1fv+D9+biU7bjY8PTjKX4jOuar KMSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=rcQNup5j; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="FGZHADj/"; 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 qh14si2397787ejb.171.2020.05.27.12.05.34; Wed, 27 May 2020 12:05:58 -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=rcQNup5j; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="FGZHADj/"; 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 S2389052AbgE0P4c (ORCPT + 98 others); Wed, 27 May 2020 11:56:32 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:36569 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390223AbgE0PuM (ORCPT ); Wed, 27 May 2020 11:50:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id D6B79582063; Wed, 27 May 2020 11:50:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 27 May 2020 11:50:11 -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=5LdLUQabqGwWb iAk4R0m424dN93YdWZ308LsyWjEzJ4=; b=rcQNup5j+9gf+s2I8Zo4FY5IAxew3 WtyIYJgDAOHFpPj6shWMDxMiGWHlplDGUPbZ3Z0lBCb+7FkMXa+75hK4T1hk0c1U PJhP2LDXQ6wdH/95oro0kjUhpDE2+t3g8TcunMqESLowDqOVc38/b+u06VIzsX52 DPfnUZ9clFtj2choArX6P1cACe8k0yO0U56to21g98eSPGKe511bNyKMNhlHUsEH UOhn0IZFujc9nJsKc/oAa1y5GJzv1JuSWccCz58OGJBOnGi3g+Jqu7vYU2CP9cIk DuT0V5f9BoO9v5mj2QDRhhGun9T30lSjPrMqPbp/QC1CwmpDtApwohW4A== 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=5LdLUQabqGwWbiAk4R0m424dN93YdWZ308LsyWjEzJ4=; b=FGZHADj/ YaCs+l0nB69zXfgZypqcEWcI0VQg9K44ELWQkelB2dYAIRhMWcH/wrzJKZXQUzAl QE1LMyE75gmwADZCr/4yofwklF05S01NOuYAwgiW19e8TmfeBsNMnc5xVqYF5pu3 0WdxteK1OT71o4FVOP2fu4mRf2uxocTDoNldK+mcXR3LdLwjGxWc2xM9YlZ4Gx7H IZXEPux9m5KuMDjte6vSSji1qNsfmx7e5jC/4TnNyCboITE9QSbR9aiDh0CQKrdQ nvuPbmjrNf6eiOZsGnJ+E4romHVG4AzioTFesvDrlCO/8N1LRudcct/CVsQNArq7 aqy1BUlELabAXQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvgedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepudegne 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 783F93280064; Wed, 27 May 2020 11:50: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 v3 034/105] drm/vc4: crtc: Add FIFO depth to vc4_crtc_data Date: Wed, 27 May 2020 17:48:04 +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 Not all pixelvalve FIFOs in vc5 have the same depth, so we need to add that to our vc4_crtc_data structure to be able to compute the fill level properly later on. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_crtc.c | 19 ++++++++++++++++--- drivers/gpu/drm/vc4/vc4_drv.h | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index a6c3f2f907bd..e25e81bf64e7 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -248,10 +248,20 @@ vc4_crtc_update_gamma_lut(struct drm_crtc *crtc) vc4_crtc_lut_load(crtc); } -static u32 vc4_get_fifo_full_level(u32 format) +static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format) { - static const u32 fifo_len_bytes = 64; + u32 fifo_len_bytes = vc4_crtc->data->fifo_depth; + /* + * Pixels are pulled from the HVS if the number of bytes is + * lower than the FIFO full level. + * + * The latency of the pixel fetch mechanism is 6 pixels, so we + * need to convert those 6 pixels in bytes, depending on the + * format, and then subtract that from the length of the FIFO + * to make sure we never end up in a situation where the FIFO + * is full. + */ switch (format) { case PV_CONTROL_FORMAT_DSIV_16: case PV_CONTROL_FORMAT_DSIC_16: @@ -367,7 +377,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc) CRTC_WRITE(PV_CONTROL, VC4_SET_FIELD(format, PV_CONTROL_FORMAT) | - VC4_SET_FIELD(vc4_get_fifo_full_level(format), + VC4_SET_FIELD(vc4_get_fifo_full_level(vc4_crtc, format), PV_CONTROL_FIFO_LEVEL) | VC4_SET_FIELD(pixel_rep - 1, PV_CONTROL_PIXEL_REP) | PV_CONTROL_CLR_AT_START | @@ -1066,6 +1076,7 @@ static const struct vc4_crtc_data bcm2835_pv0_data = { .hvs_available_channels = BIT(0), .hvs_output = 0, .debugfs_name = "crtc0_regs", + .fifo_depth = 64, .pixels_per_clock = 1, .encoder_types = { [PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI0, @@ -1077,6 +1088,7 @@ static const struct vc4_crtc_data bcm2835_pv1_data = { .hvs_available_channels = BIT(2), .hvs_output = 2, .debugfs_name = "crtc1_regs", + .fifo_depth = 64, .pixels_per_clock = 1, .encoder_types = { [PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI1, @@ -1088,6 +1100,7 @@ static const struct vc4_crtc_data bcm2835_pv2_data = { .hvs_available_channels = BIT(1), .hvs_output = 1, .debugfs_name = "crtc2_regs", + .fifo_depth = 64, .pixels_per_clock = 1, .encoder_types = { [PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_HDMI, diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 73156a53822f..1f62dffd6676 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -450,6 +450,9 @@ to_vc4_encoder(struct drm_encoder *encoder) } struct vc4_crtc_data { + /* Depth of the PixelValve FIFO in bytes */ + unsigned int fifo_depth; + /* Which channels of the HVS can the output source from */ unsigned int hvs_available_channels; -- git-series 0.9.1