From patchwork Fri Aug 18 07:29:28 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: 13357402 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 CF0D3C678DC for ; Fri, 18 Aug 2023 07:35:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09F7810E47C; Fri, 18 Aug 2023 07:35:26 +0000 (UTC) Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6E22810E47E for ; Fri, 18 Aug 2023 07:35:23 +0000 (UTC) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-688779ffcfdso525536b3a.1 for ; Fri, 18 Aug 2023 00:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1692344123; x=1692948923; 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=q0h2wCokTLJGZ1d7u4CaVmkJlNkioh2OoblHBPOXP7Y=; b=LZ/S09GEJWmCh3Jc1vyQRbIHxLeXZ7wMbdvgp124NrkNB6zxeiPQ4iWuiHS1jHVTkx haFNUUsHZ2Z5xILYueGqtjsUlUh3xhR5L7T2v1B8S2K1Hp9GiwdiT79Wbp6q6VyDMGL+ P14X7SalaJDpzwGYiKLGl3rXzOwKh7Jph/3vc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692344123; x=1692948923; 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=q0h2wCokTLJGZ1d7u4CaVmkJlNkioh2OoblHBPOXP7Y=; b=Cpb3uM9QOeeVFFmbeqixEFOjH3Zl/0Mz5Bw2zcP0U9CgT6E9YVS5byp8ED1h+jytl8 hL3GEHDfquX64ASN7jdHiX2hSyu8SIVk75ax/NGgPD/Fa86iWtmLWhas890uhzcpao8P hK3RqCanet6o8gaMubWbA/gVJ6HBuLWEjxlJISYRPtSl1DQqpK+HGwc+XvhLJmNXCFcj JPWfBfhgldyUFU+VIbqx/hIOsrtY3cJIxKPNFwDDURYt2t2tALAVAN6dNdoNO5OrTf0E x8qRFMNjaDhib8TBxQDxl0RmuIWMiukSmAo6N2hXyVPjEEoY1plxA5phVaGiVNZSLeQB 6sRA== X-Gm-Message-State: AOJu0YxOrX/GpLf9cRqKxGFgVWJnuH2Mf0hpK/ykBMSCb6+QrCJSVVJx bQ/G8jAn9/jZIJioCIwvIGOzNA== X-Google-Smtp-Source: AGHT+IHccT5ZnoRFS2s9VeYqVMvqcTSq7+uVe0UXeT+7ab+PfAvtl9e71Xj/j73DfPA6yXjXN5hIrQ== X-Received: by 2002:a05:6a20:7485:b0:13b:a2c9:922e with SMTP id p5-20020a056a20748500b0013ba2c9922emr2173938pzd.27.1692344122970; Fri, 18 Aug 2023 00:35:22 -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 c2-20020a62e802000000b00686fe7b7b48sm906041pfi.121.2023.08.18.00.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 00:35:22 -0700 (PDT) From: Brandon Pollack To: marius.vlad@collabora.com, jshargo@chromium.org Subject: [PATCH v3 3/7] drm/vkms: Provide platform data when creating VKMS devices Date: Fri, 18 Aug 2023 07:29:28 +0000 Message-ID: <20230818073411.3414628-5-brpol@chromium.org> X-Mailer: git-send-email 2.42.0.rc1.204.g551eb34607-goog In-Reply-To: <20230818073411.3414628-2-brpol@chromium.org> References: <20230818073411.3414628-2-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 This is a small refactor to make ConfigFS support easier. This should be a no-op refactor. Signed-off-by: Jim Shargo Signed-off-by: Brandon Pollack --- drivers/gpu/drm/vkms/vkms_drv.c | 14 ++++++++++++-- drivers/gpu/drm/vkms/vkms_drv.h | 9 ++++++--- drivers/gpu/drm/vkms/vkms_output.c | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 65b1e2c52106..6c94c2b5d529 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -9,6 +9,7 @@ * the GPU in DRM API tests. */ +#include "asm-generic/errno-base.h" #include #include #include @@ -171,12 +172,14 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev) dev->mode_config.preferred_depth = 0; dev->mode_config.helper_private = &vkms_mode_config_helpers; - return vkms_output_init(vkmsdev, 0); + return vkmsdev->is_default ? vkms_output_init_default(vkmsdev) : + -EINVAL; } static int vkms_platform_probe(struct platform_device *pdev) { int ret; + struct vkms_device_setup *vkms_device_setup = pdev->dev.platform_data; struct vkms_device *vkms_device; void *grp; @@ -195,6 +198,7 @@ static int vkms_platform_probe(struct platform_device *pdev) vkms_device->config.cursor = enable_cursor; vkms_device->config.writeback = enable_writeback; vkms_device->config.overlay = enable_overlay; + vkms_device->is_default = vkms_device_setup->is_default; ret = dma_coerce_mask_and_coherent(vkms_device->drm.dev, DMA_BIT_MASK(64)); @@ -258,6 +262,9 @@ static int __init vkms_init(void) { int ret; struct platform_device *pdev; + struct vkms_device_setup vkms_device_setup = { + .is_default = true, + }; ret = platform_driver_register(&vkms_platform_driver); if (ret) { @@ -265,8 +272,11 @@ static int __init vkms_init(void) return ret; } - pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); + 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); } diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index 761cd809617e..4262dcffd7e1 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -132,17 +132,20 @@ struct vkms_output { struct vkms_plane planes[VKMS_MAX_PLANES]; }; -struct vkms_device; - struct vkms_config { bool writeback; bool cursor; bool overlay; }; +struct vkms_device_setup { + bool is_default; +}; + struct vkms_device { struct drm_device drm; struct platform_device *platform; + bool is_default; struct vkms_output output; struct vkms_config config; }; @@ -166,7 +169,7 @@ struct vkms_crtc *vkms_crtc_init(struct vkms_device *vkmsdev, struct drm_plane *primary, struct drm_plane *cursor); -int vkms_output_init(struct vkms_device *vkmsdev, int index); +int vkms_output_init_default(struct vkms_device *vkmsdev); struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, enum drm_plane_type type); diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 86faf94f7408..bfc2e2362c6d 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -80,7 +80,7 @@ static struct drm_encoder *vkms_encoder_init(struct vkms_device *vkms_device) return encoder; } -int vkms_output_init(struct vkms_device *vkmsdev, int index) +int vkms_output_init_default(struct vkms_device *vkmsdev) { struct vkms_output *output = &vkmsdev->output; struct drm_device *dev = &vkmsdev->drm;