From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5852C433EF for ; Wed, 4 May 2022 10:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348448AbiEDLCa (ORCPT ); Wed, 4 May 2022 07:02:30 -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-Google-Smtp-Source: ABdhPJwscxkAohHovF4FMJCxbrKKrlnGE8Vcg8WcnudkpdOe8bMqhcqJaZWO8XXMOpSukPeZNH4/6Q== 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 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