Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1850939pxb; Wed, 9 Feb 2022 05:59:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQ29ik6QFkr04vwouHkCFwzYkFZava2Ef0/ocf7DqTZ1iqUejC0QTr5p5LgL9sd64ZK+PD X-Received: by 2002:a63:9044:: with SMTP id a65mr1953223pge.507.1644415163929; Wed, 09 Feb 2022 05:59:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644415163; cv=none; d=google.com; s=arc-20160816; b=yoSCM0aKLM+GPhwV7s+4yoO9IJ6/E1gMOCcgvSwJqYBrDGf5I5JDoCT/oDoXMGtjjX cOlQoPVwxks18HLXnZ0VjedQegRE5V9AlX/D36WXmxCJ5H0zF81rcGnMzaehsv+rMXJZ unfw0LGM6scVhaTIrr4mOUOtpKv3BAbkPJxJCkLVAoOpKSFghafHIEo7C50JZT+wrEk2 SEexW4vEHdMWuxpwqnX1RUhV+Umz2bHhhJNQaCU4WdJ5T0+4dKHG4M+GjBelsKWrbFuB NJE18Psj5OM31GDjLvPybneFqdSYNPC5lf7CZkspI60IzH10eI4Fz5oK7VYB+PDhxUHA mjPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=5AsuKlg9T3wRs6EodVp0NmABKRFh6ykn6emrypMFqcE=; b=EYpbIl49LK1fO5weOGyXg5QvnmuV2xuHKOQonQzGQUOTt+U0h59HwUkPN9K0L46pSV FNg8FN2Ab4hXuceMYH5tXYoxNMV2RbUkMR9ZyaUWwC9+SgE6Z1mielFbpTFDHT+QtOc3 2w2rQa+D8T01i9V/O/c2gu6qQs2Ff5R8UtDmHwfQrlCrVA/ik6SyEVpo62ArhiT4a5Ok 3ZsecrD6Vh2xn9RvkGy1Cmon5in517I1tCsRxUI4fCiTzhWLWASsCD/V1ik6HNADh51S Q3OEAkq1XVAnfLs1NdCjRg0Iduf0B+owOnca8D2X+Y0CUHoktqbzpYpdoSzWrSubvDXu kzlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=tJSbjzca; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VbtCkvnp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k9si14383000pll.623.2022.02.09.05.59.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 05:59:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=tJSbjzca; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VbtCkvnp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 56F1EE0A96AB; Wed, 9 Feb 2022 02:37:42 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbiBIJ6f (ORCPT + 99 others); Wed, 9 Feb 2022 04:58:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234017AbiBIJ6V (ORCPT ); Wed, 9 Feb 2022 04:58:21 -0500 Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B41EE022ADA; Wed, 9 Feb 2022 01:58:15 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 7EA74580152; Wed, 9 Feb 2022 03:52:19 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 09 Feb 2022 03:52:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; bh=5AsuKlg9T3wRs6EodVp0NmABKRFh6ykn6emryp MFqcE=; b=tJSbjzcafZKt16I56xV6jV5vxF1WGT5F2+4G9QjLLNk423jTTeO2Rc zHnaWdr4mAAI6soRoHBZs56pjt7JAyvUzDI6GRCzQyj1a1gmZ7g+T2wmruVOYhGj U/i8/jIg/iMTj3m7IC0/YXArfNPbCRIVDNcaXxkb7ake0Bexf2mKo3K2mth34ue9 WLD/Ki/AzraJGy50OZolC5AQjIFIQIrBZDPoNZ06+D6S+73CfEI/dq20rVCx1pd1 cC9msnw+U26YI4SnONvNadAzIHz1jx1T6tAsQ4IVX3uKRycsWBDPf5gB3N4FcDig 1icVgoCuAhNoi87sqBua/4Aubd977JjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=5AsuKlg9T3wRs6Eod Vp0NmABKRFh6ykn6emrypMFqcE=; b=VbtCkvnpzlBFH8WTmpIt6LRDreCQoQJub Fzshu4pCLO2vq7pubT2yKFTwOh33ovalCRzkgYSFDs630Mn0JznhTazTWLuminSU TGtgVwpIdKX9mF95t51To8n6ZHd2o22kRHvqvXqKgBWHMNGJUOywiLKq1/nrTHzA U+AoPm1h6GAcJhtILdf7WEt3n+5sUIfpqQ7oIWwoKb4ZqArlIMDXa/dbBCufPPHJ guqKP+1Dln9I5NvE17l0JStDxAOyQH3xDRTjmz/wyw2lfz5w47HGc+HJo6QGJJjv o7gpY1rPw7VatRLSZWGQwb8KttgfDtgCmtoUqcT3wc/KqRDUb84Ig== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrheekgdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepleekgeehhfdutdeljefgleejffehfffgieejhffgueefhfdtveetgeehieeh gedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Feb 2022 03:52:17 -0500 (EST) Date: Wed, 9 Feb 2022 09:52:15 +0100 From: Maxime Ripard To: Sui Jingfeng <15330273260@189.cn> Cc: Dan Carpenter , Lucas Stach , Maarten Lankhorst , Roland Scheidegger , Zack Rusin , Christian Gmeiner , David Airlie , Daniel Vetter , Rob Herring , Thomas Bogendoerfer , Krzysztof Kozlowski , Andrey Zhizhikin , Sam Ravnborg , suijingfeng , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Randy Dunlap Subject: Re: [PATCH v6 1/3] drm/lsdc: add drm driver for loongson display controller Message-ID: <20220209085215.65qbdsgwtnvujdng@houat> References: <20220203082546.3099-1-15330273260@189.cn> <20220203082546.3099-2-15330273260@189.cn> <20220203085851.yqstkfgt4dz7rcnw@houat> <57805e19-285a-76d3-16e3-09a3eb7a9540@189.cn> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ya7qckwy2foywkx2" Content-Disposition: inline In-Reply-To: <57805e19-285a-76d3-16e3-09a3eb7a9540@189.cn> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ya7qckwy2foywkx2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 03, 2022 at 11:47:16PM +0800, Sui Jingfeng wrote: > On 2022/2/3 16:58, Maxime Ripard wrote: > > > diff --git a/drivers/gpu/drm/lsdc/Kconfig b/drivers/gpu/drm/lsdc/Kcon= fig > > > new file mode 100644 > > > index 000000000000..7ed1b0fdbe1b > > > --- /dev/null > > > +++ b/drivers/gpu/drm/lsdc/Kconfig > > > @@ -0,0 +1,38 @@ > > > +config DRM_LSDC > > > + tristate "DRM Support for loongson's display controller" > > > + depends on DRM && PCI > > > + depends on MACH_LOONGSON64 || LOONGARCH || MIPS || COMPILE_TEST > > > + select OF > > > + select CMA if HAVE_DMA_CONTIGUOUS > > > + select DMA_CMA if HAVE_DMA_CONTIGUOUS > > > + select DRM_KMS_HELPER > > > + select DRM_KMS_FB_HELPER > > > + select DRM_GEM_CMA_HELPER > > > + select VIDEOMODE_HELPERS > > > + select BACKLIGHT_PWM if CPU_LOONGSON2K > > > + select I2C_GPIO if CPU_LOONGSON2K > > > + select I2C_LS2X if CPU_LOONGSON2K > > > + default m > > > + help > > > + This is a KMS driver for the display controller in the LS7A1000 > > > + bridge chip and LS2K1000 SoC. The display controller has two > > > + display pipes and it is a PCI device. > > > + When using this driver on LS2K1000/LS2K0500 SoC, its framebuffer > > > + is located at system memory. > > > + If "M" is selected, the module will be called lsdc. > > > + > > > + If in doubt, say "Y". > > > + > > > +config DRM_LSDC_VRAM_DRIVER > > > + bool "vram helper based device driver support" > > > + depends on DRM_LSDC > > > + select DRM_VRAM_HELPER > > > + default y > > > + help > > > + When using this driver on LS7A1000 + LS3A3000/LS3A4000/LS3A5000 > > > + platform, the LS7A1000 bridge chip has dedicated video RAM. Using > > > + "lsdc.use_vram_helper=3D1" in the kernel command line will enable > > > + this driver mode and then the framebuffer will be located at the > > > + VRAM at the price of losing PRIME support. > > > + > > > + If in doubt, say "Y". > > This doesn't sound right. The driver should make the proper decision > > depending on the platform, not the user or the distribution. >=20 > The LS7A1000 north bridge chip has dedicated video RAM, but the DC in LS7= A1000 > can also scanout from the system memory directly like a display controlle= r in a > SoC does. In fact, this display controller is envolved from early product= of > Loongson 2H SoC. This driver still works even if the downstream PC board > manufacturer doesn't solder a video RAM on the mother board. >=20 > The lsdc_should_vram_helper_based() function in lsdc_drv.c will examine > if the DC device node contain a use_vram_helper property at driver loadin= g time. > If there is no use_vram_helper property, CMA helper based DRM driver will= be used. > Doing this way allow the user using "lsdc.use_vram_helper=3D0" override t= he default > behavior even through there is a "use_vram_helper;" property in the DTS. >=20 > In short, It is intend to let the command line passed from kernel has hig= her > priority than the device tree. Otherwise the end user can not switch diff= erent > driver mode through the kernel command line once the DC device node conta= in > "use_vram_helper;" property. >=20 > This driver's author already made the decision by the time when the patch= is > sent out, even through this**may not proper. >=20 > The CMA helper based driver will be used by default, if the DC device nod= e contain > "use_vram_helper;" then VRAM based driver will be used. This is my initia= l intention. DT isn't really a solution either. Let's take the distribution perspective there. Suppose you're a Fedora or Debian developer, and want to make a single kernel image, and ship a DT to the user for their board without any modification. How is either the Kconfig solution or DT flags solution any good there? It doesn't help them at all. Maxime --ya7qckwy2foywkx2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYgOAvwAKCRDj7w1vZxhR xfmlAP9jrc/0alF0HbOEKem/PYILuIQZksQjvUqUpnADGQgZ2AD/YY/Mdq2iiu3Z W6nZNr9i/aZ4agM5MHGTU59+JVzfAwA= =9aeP -----END PGP SIGNATURE----- --ya7qckwy2foywkx2--