Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp950269ybm; Wed, 27 May 2020 11:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZz2GN4IziM/8QXKD2oueW3dLQQ5nYOvBY/X1JzCO9jUUymVr5OmcIiku7MVcZGtP9iLCR X-Received: by 2002:a17:906:f1c3:: with SMTP id gx3mr7178518ejb.278.1590605988040; Wed, 27 May 2020 11:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590605988; cv=none; d=google.com; s=arc-20160816; b=FiVnqabgp2Wur0trWyMyTj68qgxA+mPDWphFQU1c7hIFESTf3BNvdSUKh+w6Z0+An8 DDDdzCgrO6Tns66kqJnCP5oTXfG65ebHBZiI3iveK3RDPCtesX4BQ1oessxkbX6x0Va6 GmSagYnXuHFQtn/brNLrPj3KcswpfdTU3l7xnd2O0I5m4OGcUeU4AUl5aphVWml+r8y0 1NPHOS0stvmuKXgKo8SYVCDGeQT30QeYMdXKy1f8Jtd6hlbFdtEKeOjdo0S1mbIHRG2q 77MWO61q800QP7xO1rm+fhibi9H39ridEkywi374m/um/1NCYg16+7KJpLxB/cBpuHBt UwZw== 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=YPVkA42r4+6W/vsowzv0aziDtj61rrsZr23S9R/5TQU=; b=KwLXjxu6N2eR9IJDfOM9SxjJagiL2+0Y6+N5ersU5G0tNiERC6KSz3b50tWOZVpQkY Y+bA1VRPX7h69NyEKsAf6PjyCO0pfcWx8AUYqcbwn9ZbRyLCZ6UBmFu0PE72I8lTbZql EUZgTKyiW23GpKyPLNx5Ow0OyUAlGqUHU56nT2LbxSnnllazjax79jYBxdFlnXOqAuqt 31/OlVjP6EZwZMX4CkQPLlmnjg6Zm/6AjULMA5sbY+riCTLk8hdVTVrHU4EIz6O2trpB T4oVnyPvMVYZiFh7VAgt7cA5P6keV+Ge/dnJblTSFeN9oG6CAm8mk7YQ1wPPfE7GRbBN QpwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=XNpVcwyP; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=fufEWdsT; 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 y9si2318922ejc.567.2020.05.27.11.59.24; Wed, 27 May 2020 11:59:48 -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=XNpVcwyP; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=fufEWdsT; 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 S2390128AbgE0Pti (ORCPT + 98 others); Wed, 27 May 2020 11:49:38 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:60367 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390116AbgE0Ptg (ORCPT ); Wed, 27 May 2020 11:49:36 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id E454958200C; Wed, 27 May 2020 11:49:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 27 May 2020 11:49:35 -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=YPVkA42r4+6W/ vsowzv0aziDtj61rrsZr23S9R/5TQU=; b=XNpVcwyPtZWTwFeClLwvn2VVGagf0 Bs6fEtH3FcRLgmtRdIRmTZhM+Dnqd9yH8WxLZyW8jpLLaiPf2CB8furjPHarv0iZ PK88iGXrKVgWdVOvd7YWHlogEqhOWmOPfhhP+qa7RXAg3lDV266z9908dDdKN/sg Bdln+az6WoWgiu6rWCa2HPevnX3HH0SxgDAL/AJCWU46CGYdxldChmvktJT8zMGB TodJmt6xWaJ6BCGBbnNy6+LqroZaCcEa57wKGxDGzgSi6ZmP7dRrNjsMWl6u6+Ea 9pnWiKmKSe1xAa/7KNriWAe8yquQkCWLvL0I1oAVVaU1IBbi5K6jQh6Kg== 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=YPVkA42r4+6W/vsowzv0aziDtj61rrsZr23S9R/5TQU=; b=fufEWdsT Kd8ktmA5+TYW4s6jgpNEqmI4SxKT/fLxVb1fQGaOR3zRF2rQwh7PkMsivFmYmw3Q H7A62bRivCTmHU1SwbmD1xBucJbRDfxMGCYat3kBa2SqMjGHjeGuvgF+QrUr5FC/ OeI54ih7/O5HJ88AqxjZXoIwYxPP4xKaoOID4ZE5ZV0Kx8vW5j0Q8pEIxwVeEoQn DCAQVEFRy5cXlEf672qPvyql2E9zOToEhJ4zRFhySieFyooFB+1O1RKf1JPEvGkm D9FUEX5epNNPvN3VangyCOjGH0VeV9DezR/oho+ztyHVayTFwt6nNh3DpenuZX+Y 15/2iRPr0x8HGA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvgedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepfedune 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 84A53328005E; Wed, 27 May 2020 11:49:35 -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 012/105] drm/vc4: drv: Support BCM2711 Date: Wed, 27 May 2020 17:47:42 +0200 Message-Id: <49c552751ec619e03371bc4bb1b9ec66c8423bf7.1590594512.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 The BCM2711 has a reworked display pipeline, and the load tracker needs some adjustement to operate properly. Let's add a compatible for BCM2711 and disable the load tracker until properly supported. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_drv.c | 1 +- drivers/gpu/drm/vc4/vc4_drv.h | 3 ++- drivers/gpu/drm/vc4/vc4_kms.c | 42 +++++++++++++++++++++++----------- drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 76f93b662766..d7f554a6f0ed 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -364,6 +364,7 @@ static int vc4_platform_drm_remove(struct platform_device *pdev) } static const struct of_device_id vc4_of_match[] = { + { .compatible = "brcm,bcm2711-vc5", }, { .compatible = "brcm,bcm2835-vc4", }, { .compatible = "brcm,cygnus-vc4", }, {}, diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 6f50a91e3933..649bf47c80e5 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -201,6 +201,9 @@ struct vc4_dev { int power_refcount; + /* Set to true when the load tracker is supported. */ + bool load_tracker_available; + /* Set to true when the load tracker is active. */ bool load_tracker_enabled; diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index 78d4fb0499e3..9417e45d981f 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -415,6 +415,9 @@ static int vc4_load_tracker_atomic_check(struct drm_atomic_state *state) struct drm_plane *plane; int i; + if (!vc4->load_tracker_available) + return 0; + priv_state = drm_atomic_get_private_obj_state(state, &vc4->load_tracker); if (IS_ERR(priv_state)) @@ -514,10 +517,14 @@ int vc4_kms_load(struct drm_device *dev) struct vc4_load_tracker_state *load_state; int ret; - /* Start with the load tracker enabled. Can be disabled through the - * debugfs load_tracker file. - */ - vc4->load_tracker_enabled = true; + if (!of_device_is_compatible(dev->dev->of_node, "brcm,bcm2711-vc5")) { + vc4->load_tracker_available = true; + + /* Start with the load tracker enabled. Can be + * disabled through the debugfs load_tracker file. + */ + vc4->load_tracker_enabled = true; + } sema_init(&vc4->async_modeset, 1); @@ -531,8 +538,14 @@ int vc4_kms_load(struct drm_device *dev) return ret; } - dev->mode_config.max_width = 2048; - dev->mode_config.max_height = 2048; + if (!of_device_is_compatible(dev->dev->of_node, "brcm,bcm2711-vc5")) { + dev->mode_config.max_width = 7680; + dev->mode_config.max_height = 7680; + } else { + dev->mode_config.max_width = 2048; + dev->mode_config.max_height = 2048; + } + dev->mode_config.funcs = &vc4_mode_funcs; dev->mode_config.preferred_depth = 24; dev->mode_config.async_page_flip = true; @@ -547,14 +560,17 @@ int vc4_kms_load(struct drm_device *dev) drm_atomic_private_obj_init(dev, &vc4->ctm_manager, &ctm_state->base, &vc4_ctm_state_funcs); - load_state = kzalloc(sizeof(*load_state), GFP_KERNEL); - if (!load_state) { - drm_atomic_private_obj_fini(&vc4->ctm_manager); - return -ENOMEM; - } + if (vc4->load_tracker_available) { + load_state = kzalloc(sizeof(*load_state), GFP_KERNEL); + if (!load_state) { + drm_atomic_private_obj_fini(&vc4->ctm_manager); + return -ENOMEM; + } - drm_atomic_private_obj_init(dev, &vc4->load_tracker, &load_state->base, - &vc4_load_tracker_state_funcs); + drm_atomic_private_obj_init(dev, &vc4->load_tracker, + &load_state->base, + &vc4_load_tracker_state_funcs); + } drm_mode_config_reset(dev); diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 91e408f7a56e..57a73a2e2e5c 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -492,6 +492,11 @@ static void vc4_plane_calc_load(struct drm_plane_state *state) struct vc4_plane_state *vc4_state; struct drm_crtc_state *crtc_state; unsigned int vscale_factor; + struct vc4_dev *vc4; + + vc4 = to_vc4_dev(state->plane->dev); + if (!vc4->load_tracker_available) + return; vc4_state = to_vc4_plane_state(state); crtc_state = drm_atomic_get_existing_crtc_state(state->state, -- git-series 0.9.1