Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp457788iob; Tue, 3 May 2022 02:12:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ7D8GwlC2Q7TgcgLvsnt6L5XPMnoOUKjc00EAs6lQLRlKQkBCKYa7nmKMNLPMvLHNMWli X-Received: by 2002:a05:6512:252a:b0:472:5ae1:139f with SMTP id be42-20020a056512252a00b004725ae1139fmr9344682lfb.613.1651569176117; Tue, 03 May 2022 02:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651569176; cv=none; d=google.com; s=arc-20160816; b=It4uuJS2dwD08zTJjq5j82K4d4cTyi2GvWUFJiYBZoW0bTok0alyfQy+ZY3xOvFTZp cgvNcN2mX9VOafUWhJt//vehnLuv6fN5ATm8MW6QoD25PLKm8vyKHzWjXwU8ehEcZjW0 MGhsOg5buunDZhHG1Wo/c/ultlWzLre1k1GHFDyoFRIcyB16fEhDSrDoz3Yd2QWG7sdR 7cNKd4vUmtDyevq/rCuOslvB3VI3KNmAQApKSRjRd0NQUFnj6f8RuIZFM84T8vEdaEI7 kqH9v+GlS4Rn9CBgrN/4xDZ9MiznHcNVA+0zsENsX8D1nIDsNL5GhdZG/mB/VK8YmZD5 mRDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=p7Xo+XfuxpwgRvmh+x+4llEf06yjZT56T0kzU1GhsAM=; b=JybjzBnyak5mmVl5R+SAP6l2Bmh0UIo+e3de0cIxTdIAlNEk2LlgJwyc5smQgZzC4D gwBIsYEtpk2csW8oKBlCM/Fs3Mj4F/zHwhB3CXi0tbIc7AiINC7xK420Z0bqEX4jd2GL hrCOLL+sybNsWZwtLTsm/MdBqBJN05mwjSspvkVy8m95ljdhlpNsl7lVbBG9h2vGUvZ5 P1ov2QIVAbrKKf34YDGlxXCnF2IeYsvY9IoQQ1vBWePe+iQmZVJihUf52AzdI6Umv2gv Js7H++SxD+/WMwtXLNogvrrYMPJM7Eficl0XJCEun4yaP7iIZhWRAC3UbaiMpkfXAYGL AJwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gGzpUKbE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a2e90c9000000b0024dc48e757csi15956792ljg.168.2022.05.03.02.12.27; Tue, 03 May 2022 02:12:56 -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=@redhat.com header.s=mimecast20190719 header.b=gGzpUKbE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231220AbiECHT6 (ORCPT + 99 others); Tue, 3 May 2022 03:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231788AbiECHTb (ORCPT ); Tue, 3 May 2022 03:19:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 90A4B2D1D6 for ; Tue, 3 May 2022 00:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651562155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p7Xo+XfuxpwgRvmh+x+4llEf06yjZT56T0kzU1GhsAM=; b=gGzpUKbEHv6eL/NhtrlFojh6SQwqzJd9sSNxI1qe027y2Yhzg/3oCNI7psBV31AyErzrCf rh/QZzF0zEJdwfyf0h9UdpMWroASfwLuZ6KEorFaNm0nmGqznJMvIJuvtM9VLtcCnAogAq Ho0ubciKo8DGf29nV0dYqOfbQdIwiXc= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-5-g89Av_XDM76u8LCGAQDmxw-1; Tue, 03 May 2022 03:15:54 -0400 X-MC-Unique: g89Av_XDM76u8LCGAQDmxw-1 Received: by mail-wr1-f70.google.com with SMTP id g7-20020adfbc87000000b0020ac76d254bso6066057wrh.6 for ; Tue, 03 May 2022 00:15:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p7Xo+XfuxpwgRvmh+x+4llEf06yjZT56T0kzU1GhsAM=; b=sybjwLb5ofPSfJMUwVO2606MIA1fX3S3n527ascG7L9KuZDNU1UUgsXoc/OqowZZkI /gplsviFeqtCJAmZ/vZDNf8k7iPJnWfVsh/xq4rYDmZPBEWu+YOcbWumIMse7Jlw9UhG qG7Mu+vMcnX+tjxl/8W0wDpJBvHq9sJJlG8/kwjgFPUy0hZcLS/V+yDEsENohegs155M wpm5QTtYfrZC/Dw6uFWUJSm3a9CD9E8Sx+w2w0MG58QijQ2bHXJagPyrVZDccOGNy+UN mLRrBba4AdYDXq2AjlhDA8OlUG1CtTA8o9NqXZ7+GV5+WOlvDpZCvWqlsuOdb3hGteiU EeOg== X-Gm-Message-State: AOAM532IP2XW2LvpwLSftnGOCBBhacuc5Zn7+3IGUHzUcM1ueOz2bffT L92PIo/S63ZJzObAH8jxzK2BA0W3KBYXGY8Azos0OcxCCgIqQFJCShaBmMTkrze5xuMz6D2Uhnk P4V6Yc4mF/g0PbGJWqZgZ3r+B1YSSjV0udjH+9tVCq7MMzAM8PZpFJPIxhR6yaCkSBeNY79woOQ w= X-Received: by 2002:a05:6000:156a:b0:20c:64e3:948f with SMTP id 10-20020a056000156a00b0020c64e3948fmr5556154wrz.436.1651562153611; Tue, 03 May 2022 00:15:53 -0700 (PDT) X-Received: by 2002:a05:6000:156a:b0:20c:64e3:948f with SMTP id 10-20020a056000156a00b0020c64e3948fmr5556139wrz.436.1651562153365; Tue, 03 May 2022 00:15:53 -0700 (PDT) Received: from minerva.home ([92.176.231.205]) by smtp.gmail.com with ESMTPSA id o20-20020a05600c339400b003942a244f33sm1035387wmp.12.2022.05.03.00.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 00:15:52 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Daniel Vetter , Thomas Zimmermann , Laurent Pinchart , Javier Martinez Canillas , dri-devel@lists.freedesktop.org Subject: [PATCH v3 3/3] drm: Allow simpledrm to setup its emulated FB as firmware provided Date: Tue, 3 May 2022 09:15:40 +0200 Message-Id: <20220503071540.471667-4-javierm@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503071540.471667-1-javierm@redhat.com> References: <20220503071540.471667-1-javierm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, 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 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). 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