Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1416495pxk; Fri, 4 Sep 2020 08:52:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWG0KHSg6zXlUJ2VKx4xGLLQgX4FwQI3eP9NoCJ5dz3jxFRNcQccgMCHL4HelvF0fCDdyC X-Received: by 2002:a50:bb26:: with SMTP id y35mr9650404ede.234.1599234771118; Fri, 04 Sep 2020 08:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599234771; cv=none; d=google.com; s=arc-20160816; b=GnazVllB0+jjyxBHR94L9Pns3dXiJlguQFuqC7u/DrN/zOZHWdUjwd3e2kRnPPmppC 6VRPHnTvlJ5jsIGsHJgxkL74bCDJYYhgNhLg1nkF/D3WIe6LgvTUJxUCIv5IbL9eNUWY NOBK68f3dUJpfVmC+4LRuNALeFxcfk8rXAaCQz/AmBu/i73LG/cIMuOgb57pOJHnU7zP UGji1u/9eCqdYqk/LrvEacsCLHV4HqvzIY52gQLShPclM0wM7sk/xv0IBzrbNr7Tywer QjbdSXvsRFP9moo2yKUxSwCqQtNEenDa0vek5XJfxpQUBumNHOen4YopxWstMsdf2iPh IoZw== 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=+mUIkf5+wSrm/eOZF7pJYOzf+3jat87UbehRU5d1CD4=; b=bnYLesJpwGmA7v57M8DFWW19sKS4OVl8T/9izdUmsZCxwBfhSvbheVruDKfiPdjLwY qERU8iuVLZTTE5hwH59jaJ0ddWX4epznBvEk6SgYJ+vBxW0sktjfa4ZjvkMDEhckisFR 1osDnlyWBWG112AHb/cGYJHLGApRksJ+i4jjIU+1z4Lqc19AdyQltIrcCMMADMcXVWL4 HW0bvAOWssNny9JIfxW7SrpkF+PHsFRKkyRYAnQSbcmyMeRg7d5OkftZl3REXkNHK3ZD Zc6MDQCEWOPa7rdPoq+ylQt6XfyEdnlStYdvqoRN0DRhMboqF3TCX0ks8wmcBmsQkfAf DmSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=ctlOJyDx; 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 f7si4242162ejt.351.2020.09.04.08.52.27; Fri, 04 Sep 2020 08:52:51 -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=ctlOJyDx; 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 S1726308AbgIDPvn (ORCPT + 99 others); Fri, 4 Sep 2020 11:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbgIDPvm (ORCPT ); Fri, 4 Sep 2020 11:51:42 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA77FC061244 for ; Fri, 4 Sep 2020 08:51:41 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id k15so7193124wrn.10 for ; Fri, 04 Sep 2020 08:51:41 -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=+mUIkf5+wSrm/eOZF7pJYOzf+3jat87UbehRU5d1CD4=; b=ctlOJyDxNnInQWTjGofcghYd8KfO8SgyHTC6gCppdxK0TvyA9HS2p/aVj9h9So7J5/ udjKiN+Q6VjQpb3vEQXFQ7uZN9LqWakT6awNFc6XlK3vzZy18iU8Lu066utYipZNZrWg Tf65wHzRBTDvSAZ7079Aepz5+qFAlMKSRKmd2xzua42SCMZQBBwDoKMldF+tx2WKlkyx VzoXt48tG+KSkEOePMS1j0xCZxw+OFBbzhsR8OhUaGKUhi4WHTNwrcfOQ6CwT/2DMU4c 02hw93ZPf0sJy49WW/hEFgcwXDnVazQefsrvwe7LpEQzU8GWov0cthRSoQTRa9GAfY5V 2YYg== 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=+mUIkf5+wSrm/eOZF7pJYOzf+3jat87UbehRU5d1CD4=; b=V6R1zdMNLQ2MxaKsqFtXMA6u9x40NhiIC4AoWprYekCcZ/571+I92XamGVg1XVMzzU Ne7V51nvd890PkU+GuMt1plwpbH1tBZrhjAhK8j0ZoqHQ7N3ya3Olc5ax835KThc7sWi +qL5VE8WcPw27TPRA+xa41Q/3EDQQrhublSURZdVhGcDGclIgXrXXVoAhrDyPFmDw8lY aKUhMZIArU8FkplGTBbec+uRCOHL024j7OMV5+yoKmCxHZa6gyYhtTbeYAk7R1t7Q5sk w2+kPJtTtlKcIGk9cXre++2m2Hth0vitIr74uqM3aDRazUFggItLuE6qrmNvmjZxDQis 2UKg== X-Gm-Message-State: AOAM533pRAifzYqRh6P4ZO5MkxJyPS2+bR2HqmBVLPdWpM24nvjgiiFe c2/ZCv7TiMOXAvSilxc3Zv1JrNxqXXtQ78ce271u5Q== X-Received: by 2002:adf:ec0a:: with SMTP id x10mr7947475wrn.47.1599234700474; Fri, 04 Sep 2020 08:51:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Stevenson Date: Fri, 4 Sep 2020 16:51:25 +0100 Message-ID: Subject: Re: [PATCH v5 79/80] drm/vc4: drv: Support BCM2711 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 , Chanwoo Choi , Hoegeun Kwon , Stefan Wahren 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 Thu, 3 Sep 2020 at 09:03, Maxime Ripard wrote: > > The BCM2711 has a reworked display pipeline, and the load tracker needs > some adjustment to operate properly. Let's add a compatible for BCM2711 > and disable the load tracker until properly supported. > > Tested-by: Chanwoo Choi > Tested-by: Hoegeun Kwon > Tested-by: Stefan Wahren > Signed-off-by: Maxime Ripard I'm happy with this. Potentially a case for having split it into two patches (make the load tracker optional, and then use that option for the new compatible), but I'm not convinced, so: Reviewed-by: Dave Stevenson > --- > drivers/gpu/drm/vc4/vc4_drv.c | 1 +- > drivers/gpu/drm/vc4/vc4_drv.h | 3 ++- > drivers/gpu/drm/vc4/vc4_kms.c | 44 +++++++++++++++++++++++----------- > drivers/gpu/drm/vc4/vc4_plane.c | 5 ++++- > 4 files changed, 40 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c > index 9567d1019212..f1a5fd5dab6f 100644 > --- a/drivers/gpu/drm/vc4/vc4_drv.c > +++ b/drivers/gpu/drm/vc4/vc4_drv.c > @@ -372,6 +372,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 501a48a714d3..8c8d96b6289f 100644 > --- a/drivers/gpu/drm/vc4/vc4_drv.h > +++ b/drivers/gpu/drm/vc4/vc4_drv.h > @@ -200,6 +200,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 bfc7ddd49ac5..16e233e1406e 100644 > --- a/drivers/gpu/drm/vc4/vc4_kms.c > +++ b/drivers/gpu/drm/vc4/vc4_kms.c > @@ -536,6 +536,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)) > @@ -683,12 +686,18 @@ int vc4_kms_load(struct drm_device *dev) > struct vc4_dev *vc4 = to_vc4_dev(dev); > struct vc4_ctm_state *ctm_state; > struct vc4_load_tracker_state *load_state; > + bool is_vc5 = of_device_is_compatible(dev->dev->of_node, > + "brcm,bcm2711-vc5"); > int ret; > > - /* Start with the load tracker enabled. Can be disabled through the > - * debugfs load_tracker file. > - */ > - vc4->load_tracker_enabled = true; > + if (!is_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); > > @@ -702,8 +711,14 @@ int vc4_kms_load(struct drm_device *dev) > return ret; > } > > - dev->mode_config.max_width = 2048; > - dev->mode_config.max_height = 2048; > + if (is_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; > @@ -718,14 +733,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 1e38e603f83b..24d7e6db6fdd 100644 > --- a/drivers/gpu/drm/vc4/vc4_plane.c > +++ b/drivers/gpu/drm/vc4/vc4_plane.c > @@ -516,6 +516,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