Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp881440iob; Wed, 4 May 2022 09:49:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzsppz7R5nSbBlri/c0g7Qmmc1YJvEfYys72VM4xaz2y3xNwTDhs+GJTE6uP+UQdsAn+o9 X-Received: by 2002:a17:907:9482:b0:6da:a24e:e767 with SMTP id dm2-20020a170907948200b006daa24ee767mr20860114ejc.479.1651682957355; Wed, 04 May 2022 09:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651682957; cv=none; d=google.com; s=arc-20160816; b=F7aBKLjOCrGINZ5LpBwYZ9r0j/1kVJIh0vouk18a6hLAtJeoN3XZ8vLjZzLPftDuQD hNYeFo1RhxyearwDHzUL0QMQByw3McJQfgQaBerkM+WzZi2Dt2TKWiuvCT/Sc9tgVKKZ vE0ynAqnV7OZJqENNSHuXcc7JyYdmrvh66oumiGAL/dKv3Bgy82BbfA+VtZbnDmFgwyY qgT3WoBqLMDo5pNNdkssA/0s6IiFG7P1SNH1EK9UsaW/hGrqkahHAiQwyd4D1ZcJ/H9l 1bJxX3ekO9J+ZOmnsx9/zbijNuMDlbQ2f3ctFdx8RUmVaufGvr7/3/avhDuZOOc8djyP EI3A== 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:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=X5wC/y8l3phzvrxUj5g6Q/bU6cd0GrNgtke4GEPDYJA=; b=YAcrvnMSiL/BLLQgi2NDNGom2gWnlVnUB2v1+EOWNP5f4R4uN/dDN78SndviP9g5Au BYDvSlffO8zHWxNkgj6xJpIEwF43YsSuvrW7CkMjdlrNra5m8D/cL+pfYcvMT/JLKfwJ vK3T4ccXLS0uutgBSN0bvtKN1xXR8xwOjU1ZFdjNxnOrImFYkG5UlTE+ClrC3JDIws7V uTFOBOp+FD55mzR0+miunJAHZwz+0Ph/trLziNQs+ONHJoifiMlwfhXIfJl54/UdtWPc JC9ahR40cu8vX1gKn6/Xd4R/O++FzUJPiy5NqKv2LLb0UpbazNWxU7QFQB7GO0VsQZdX 0d3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=j6UtRjbI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a170906296900b006e8310f72e9si15736306ejd.653.2022.05.04.09.48.53; Wed, 04 May 2022 09:49:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=j6UtRjbI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348440AbiEDLC3 (ORCPT + 99 others); Wed, 4 May 2022 07:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234997AbiEDLC2 (ORCPT ); Wed, 4 May 2022 07:02:28 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99EB41C13F for ; Wed, 4 May 2022 03:58:52 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id ba17so1262572edb.5 for ; Wed, 04 May 2022 03:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=X5wC/y8l3phzvrxUj5g6Q/bU6cd0GrNgtke4GEPDYJA=; b=j6UtRjbIBuPRag8NUVR1g+vsc1IRIjHiP/quPZKZ+CNUClMzeYRLSoTiU6sUL6tMbh Ch+JDUZAINX+5lvGFdJ55Z14C3ED7UgQ9rYGgiqFnQiw7H7vVNCtaCbpOzcTjXnW5Qik 5H1x+DRmxmcvYtfkYGS1kgUy7v5guMdLC0S6Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=X5wC/y8l3phzvrxUj5g6Q/bU6cd0GrNgtke4GEPDYJA=; b=DZtD6ZH6m4Ju4FGteg3CssOlxRzhFkWeSPtQn1U3z8Osf96LUkMcnxTE3KZetGfuWv GiWSZOv8QYZX2cNL6KfOLzob6KHoH26HzbfUWTPe/F9ifhi6J6KfNRDgKdqo/K3G8ZSD KP2nnxl2H9DUuFvGw2wb6YhhU9M+Rffqy6jNmvOXYPC4xVSuaZg2OyVaHDZOAW4oW8rx xbYdQ++PxtJ1HP+YbQgy9M4iAOQ6idIKYjDBP3twPWLGg2MqOMzT2dzGNgBrPh+MD8Wx 0La+ecTnODcxDZMyd3JycP5u+sGCjZTuQe1A4BBQ0YwK50pKh2DgzW82HiBoWhTzfwOX OLWw== X-Gm-Message-State: AOAM530Fb+3HQ7uIo7wrm6bnhD2Srko+/mGXRpAqkRd4oK/z+e51Yjix e3ZL/CrSX5PLb+2nyko5rPp4og== X-Received: by 2002:a50:ee11:0:b0:425:b5b3:a48d with SMTP id g17-20020a50ee11000000b00425b5b3a48dmr22842334eds.246.1651661931124; Wed, 04 May 2022 03:58:51 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id dq9-20020a170907734900b006f3ef214de3sm5590177ejc.73.2022.05.04.03.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 03:58:50 -0700 (PDT) Date: Wed, 4 May 2022 12:58:49 +0200 From: Daniel Vetter To: Javier Martinez Canillas Cc: linux-kernel@vger.kernel.org, Daniel Vetter , Thomas Zimmermann , Laurent Pinchart , dri-devel@lists.freedesktop.org Subject: Re: [PATCH v3 3/3] drm: Allow simpledrm to setup its emulated FB as firmware provided Message-ID: Mail-Followup-To: Javier Martinez Canillas , linux-kernel@vger.kernel.org, Thomas Zimmermann , Laurent Pinchart , dri-devel@lists.freedesktop.org References: <20220503071540.471667-1-javierm@redhat.com> <20220503071540.471667-4-javierm@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220503071540.471667-4-javierm@redhat.com> X-Operating-System: Linux phenom 5.10.0-8-amd64 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Tue, May 03, 2022 at 09:15:40AM +0200, Javier Martinez Canillas wrote: > Indicate to fbdev subsystem that the registered framebuffer is provided by > the system firmware, so that it can handle accordingly. For example, would > unregister the FB devices if asked to remove the conflicting framebuffers. > > Add a new DRM_FB_FW field to drm_fbdev_generic_setup() options parameter. > Drivers can use this to indicate the FB helper initialization that the FB > registered is provided by the firmware, so it can be configured as such. > > Suggested-by: Thomas Zimmermann > Signed-off-by: Javier Martinez Canillas > Reviewed-by: Thomas Zimmermann > Reviewed-by: Laurent Pinchart > --- > > Changes in v3: > - Drop the firmware local variable (Laurent Pinchart). > - Use DRM_FB_OPTION() since DRM_FB_SET_OPTION() got renamed (kernel test robot). Just for the record what I brought up on irc already: FBINFO_MISC_FIRMWARE is purely an internal flag with no uapi impact, and it's only to control whether we nuke this from remove_conflicting_framebuffer or not. Since simpledrm only ever binds against sysfb I think it'd be cleaner to only rely on that, and relegate that entire FBINFO_MISC_FIRMWARE misc hack to the fbdev dungeons and let it quietly wither away there. Also I'm not a huge fan of these midlayer flags in general :-) -Daniel > > drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++ > drivers/gpu/drm/tiny/simpledrm.c | 2 +- > include/drm/drm_fb_helper.h | 10 ++++++++++ > 3 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 52042ba1e4cf..28b21858b726 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -1891,6 +1891,10 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper, > /* don't leak any physical addresses to userspace */ > info->flags |= FBINFO_HIDE_SMEM_START; > > + /* Indicate that the framebuffer is provided by the firmware */ > + if (fb_helper->firmware) > + info->flags |= FBINFO_MISC_FIRMWARE; > + > /* Need to drop locks to avoid recursive deadlock in > * register_framebuffer. This is ok because the only thing left to do is > * register the fbdev emulation instance in kernel_fb_helper_list. */ > @@ -2512,6 +2516,8 @@ static const struct drm_client_funcs drm_fbdev_client_funcs = { > * > * * DRM_FB_BPP: bits per pixel for the device. If the field is not set, > * @dev->mode_config.preferred_depth is used instead. > + * * DRM_FB_FW: if the framebuffer for the device is provided by the > + * system firmware. > * > * This function sets up generic fbdev emulation for drivers that supports > * dumb buffers with a virtual address and that can be mmap'ed. > @@ -2569,6 +2575,8 @@ void drm_fbdev_generic_setup(struct drm_device *dev, const unsigned int options) > if (!fb_helper->preferred_bpp) > fb_helper->preferred_bpp = 32; > > + fb_helper->firmware = DRM_FB_GET_OPTION(DRM_FB_FW, options); > + > ret = drm_fbdev_client_hotplug(&fb_helper->client); > if (ret) > drm_dbg_kms(dev, "client hotplug ret=%d\n", ret); > diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c > index f5b8e864a5cd..f6f1c5e108b2 100644 > --- a/drivers/gpu/drm/tiny/simpledrm.c > +++ b/drivers/gpu/drm/tiny/simpledrm.c > @@ -901,7 +901,7 @@ static int simpledrm_probe(struct platform_device *pdev) > if (ret) > return ret; > > - drm_fbdev_generic_setup(dev, 0); > + drm_fbdev_generic_setup(dev, DRM_FB_OPTION(DRM_FB_FW, 1)); > > return 0; > } > diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h > index 5fc41cf0c987..5a17af423944 100644 > --- a/include/drm/drm_fb_helper.h > +++ b/include/drm/drm_fb_helper.h > @@ -44,6 +44,7 @@ enum mode_set_atomic { > }; > > #define DRM_FB_BPP_MASK GENMASK(7, 0) > +#define DRM_FB_FW_MASK GENMASK(8, 8) > > /* Using the GNU statement expression extension */ > #define DRM_FB_OPTION(option, value) \ > @@ -197,6 +198,15 @@ struct drm_fb_helper { > * See also: @deferred_setup > */ > int preferred_bpp; > + > + /** > + * @firmware: > + * > + * Set if the driver indicates to the FB helper initialization that the > + * framebuffer for the device being registered is provided by firmware, > + * so that it can pass this on when registering the framebuffer device. > + */ > + bool firmware; > }; > > static inline struct drm_fb_helper * > -- > 2.35.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch