From patchwork Thu Aug 24 08:40:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Ross Pollack X-Patchwork-Id: 13363773 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 270FCC27C40 for ; Thu, 24 Aug 2023 08:44:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8BD8810E4FB; Thu, 24 Aug 2023 08:44:45 +0000 (UTC) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A7EE10E4F4 for ; Thu, 24 Aug 2023 08:44:40 +0000 (UTC) Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2685bcd046eso3686231a91.3 for ; Thu, 24 Aug 2023 01:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1692866680; x=1693471480; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UibU+Wd31ET9DKxhDYToQOnKhMNxhV0MyhlXlmFI9GI=; b=YHo02qxMi64msVO+7UMM7l8e9W3mPRNZpEcvc8FFufBNFJEHdfKrK0wZWhsZQgld3k 1SYtyo63iJFqaHbev0Ugi/tdDDNOX3eIf621djNs2Q+4JnXGiWJKvtb94w5RRPC9Iyb/ wrPntZcYzZpIHGgfWfhdsVjK0YiH+NN+nGGd0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692866680; x=1693471480; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UibU+Wd31ET9DKxhDYToQOnKhMNxhV0MyhlXlmFI9GI=; b=UCHOuQ+HTJYidNXLH4bRH6df5+Rg1GlLygKbcPSjKZYmoTPBuCGN0MNSleh0T3TVxj /zQoWky2K42iphT81sVwp982ASs+QmD/IQIljnLX3n7sky/LPyVnZXK0myqhgHv93LUU F/pk3FIStI1++UnrY2JM5QwD5LYEcR5lYvjDr4TWUFQu0rVd6ZDbeGqnUWD2s+Va9KhJ YN4OieuBP27ivuN7fa/7PTu4s7Hd+6aY2aioPHl6GCWGHhUlTAn1qsDGqh8gElEGXpzi Ra7li/+JKaA5OYEvnz+a73AoryikqKUrO82zXOtr30tNXTBN0j//BD+ZmzHdZvXEt/Hn KarA== X-Gm-Message-State: AOJu0YyWkFpUVJiojSBnvwRdg0LKB9+vkFVXXBjgPYkO81oF52nw8uQc JEARKmvJOqrZnRIkGJmDut8eEA== X-Google-Smtp-Source: AGHT+IFwpaNTNsORjA+hNNZO0C8AtRGFbppgjjAZ6BMplBapQU30frf6aN8ELJRkTA/7CvIBhx4aaw== X-Received: by 2002:a17:90b:1e0b:b0:268:5d00:3751 with SMTP id pg11-20020a17090b1e0b00b002685d003751mr11226477pjb.10.1692866680203; Thu, 24 Aug 2023 01:44:40 -0700 (PDT) Received: from datalore.c.googlers.com.com (148.175.199.104.bc.googleusercontent.com. [104.199.175.148]) by smtp.gmail.com with ESMTPSA id 12-20020a17090a194c00b00268188ea4b9sm1150216pjh.19.2023.08.24.01.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 01:44:39 -0700 (PDT) From: Brandon Pollack To: marius.vlad@collabora.com, jshargo@chromium.org Subject: [PATCH v4 6/7] drm/vkms: Add a module param to enable/disable the default device Date: Thu, 24 Aug 2023 08:40:37 +0000 Message-ID: <20230824084350.1062579-7-brpol@chromium.org> X-Mailer: git-send-email 2.42.0.rc1.204.g551eb34607-goog In-Reply-To: <20230824084350.1062579-1-brpol@chromium.org> References: <20230824084350.1062579-1-brpol@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hamohammed.sa@gmail.com, rodrigosiqueiramelo@gmail.com, linux-doc@vger.kernel.org, hirono@chromium.org, mduggan@chromium.org, corbet@lwn.net, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, melissa.srw@gmail.com, mairacanal@riseup.net, mripard@kernel.org, tzimmermann@suse.de, Brandon Pollack Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Jim Shargo In many testing circumstances, we will want to just create a new device and test against that. If we create a default device, it can be annoying to have to manually select the new device instead of choosing the only one that exists. The param, enable_default, is defaulted to true to maintain backwards compatibility. Signed-off-by: Jim Shargo Signed-off-by: Brandon Pollack --- drivers/gpu/drm/vkms/vkms_drv.c | 45 ++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 6e7f20681890..293bebf8e8ce 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -42,17 +42,26 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 +static bool enable_default_device = true; +module_param_named(enable_default_device, enable_default_device, bool, 0444); +MODULE_PARM_DESC(enable_default_device, + "Enable/Disable creating the default device"); + static bool enable_cursor = true; module_param_named(enable_cursor, enable_cursor, bool, 0444); -MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support"); +MODULE_PARM_DESC(enable_cursor, + "Enable/Disable cursor support for the default device"); static bool enable_writeback = true; module_param_named(enable_writeback, enable_writeback, bool, 0444); -MODULE_PARM_DESC(enable_writeback, "Enable/Disable writeback connector support"); +MODULE_PARM_DESC( + enable_writeback, + "Enable/Disable writeback connector support for the default device"); static bool enable_overlay; module_param_named(enable_overlay, enable_overlay, bool, 0444); -MODULE_PARM_DESC(enable_overlay, "Enable/Disable overlay support"); +MODULE_PARM_DESC(enable_overlay, + "Enable/Disable overlay support for the default device"); DEFINE_DRM_GEM_FOPS(vkms_driver_fops); @@ -99,6 +108,7 @@ static int vkms_config_show(struct seq_file *m, void *data) struct drm_device *dev = entry->dev; struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev); + seq_printf(m, "default_device=%d\n", enable_default_device); seq_printf(m, "writeback=%d\n", vkmsdev->config.writeback); seq_printf(m, "cursor=%d\n", vkmsdev->config.cursor); seq_printf(m, "overlay=%d\n", vkmsdev->config.overlay); @@ -297,10 +307,7 @@ void vkms_remove_device(struct vkms_device *vkms_device) static int __init vkms_init(void) { int ret; - struct platform_device *pdev; - struct vkms_device_setup vkms_device_setup = { - .configfs = NULL, - }; + struct platform_device *default_pdev = NULL; ret = platform_driver_register(&vkms_platform_driver); if (ret) { @@ -308,19 +315,27 @@ static int __init vkms_init(void) return ret; } - pdev = platform_device_register_data(NULL, DRIVER_NAME, 0, - &vkms_device_setup, - sizeof(vkms_device_setup)); - if (IS_ERR(pdev)) { - DRM_ERROR("Unable to register default vkms device\n"); - platform_driver_unregister(&vkms_platform_driver); - return PTR_ERR(pdev); + if (enable_default_device) { + struct vkms_device_setup vkms_device_setup = { + .configfs = NULL, + }; + + default_pdev = platform_device_register_data( + NULL, DRIVER_NAME, 0, &vkms_device_setup, + sizeof(vkms_device_setup)); + if (IS_ERR(default_pdev)) { + DRM_ERROR("Unable to register default vkms device\n"); + platform_driver_unregister(&vkms_platform_driver); + return PTR_ERR(default_pdev); + } } ret = vkms_init_configfs(); if (ret) { DRM_ERROR("Unable to initialize configfs\n"); - platform_device_unregister(pdev); + if (default_pdev) + platform_device_unregister(default_pdev); + platform_driver_unregister(&vkms_platform_driver); }