dri-devel Archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Brandon Pollack <brpol@chromium.org>
Cc: marius.vlad@collabora.com, mairacanal@riseup.net,
	jshargo@chromium.org, hamohammed.sa@gmail.com,
	rodrigosiqueiramelo@gmail.com, linux-doc@vger.kernel.org,
	hirono@chromium.org, corbet@lwn.net,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	melissa.srw@gmail.com, mduggan@chromium.org, mripard@kernel.org,
	tzimmermann@suse.de
Subject: Re: [PATCH v6 3/7] drm/vkms: Provide platform data when creating VKMS devices
Date: Tue, 30 Apr 2024 09:53:56 +0200	[thread overview]
Message-ID: <ZjCjlCmMQjOzrdD0@phenom.ffwll.local> (raw)
In-Reply-To: <20230829053201.423261-4-brpol@chromium.org>

On Tue, Aug 29, 2023 at 05:30:55AM +0000, Brandon Pollack wrote:
> From: Jim Shargo <jshargo@chromium.org>
> 
> This is a small refactor to make ConfigFS support easier. This should be
> a no-op refactor.
> 
> Signed-off-by: Jim Shargo <jshargo@chromium.org>
> Signed-off-by: Brandon Pollack <brpol@chromium.org>

This should be part of the series to switch over to a real platform
driver, since we only need that with that design and not with the current
setup/init code.
-Sima

> ---
>  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 <linux/device.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> @@ -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;
> -- 
> 2.42.0.rc2.253.gd59a3bf2b4-goog
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2024-04-30  7:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29  5:30 [PATCH v6 0/7] Adds support for ConfigFS to VKMS! Brandon Pollack
2023-08-29  5:30 ` [PATCH v6 1/7] drm/vkms: Back VKMS with DRM memory management instead of static objects Brandon Pollack
2024-04-30  7:47   ` Daniel Vetter
2023-08-29  5:30 ` [PATCH v6 2/7] drm/vkms: Support multiple DRM objects (crtcs, etc.) per VKMS device Brandon Pollack
2023-09-01  9:33   ` Marius Vlad
2024-04-30  7:53   ` Daniel Vetter
2023-08-29  5:30 ` [PATCH v6 3/7] drm/vkms: Provide platform data when creating VKMS devices Brandon Pollack
2024-04-30  7:53   ` Daniel Vetter [this message]
2023-08-29  5:30 ` [PATCH v6 4/7] drm/vkms: Add ConfigFS scaffolding to VKMS Brandon Pollack
2024-04-30  8:14   ` Daniel Vetter
2023-08-29  5:30 ` [PATCH v6 5/7] drm/vkms: Support enabling ConfigFS devices Brandon Pollack
2024-04-30  8:22   ` Daniel Vetter
2024-04-30  8:32   ` Daniel Vetter
2023-08-29  5:30 ` [PATCH v6 6/7] drm/vkms: Add a module param to enable/disable the default device Brandon Pollack
2023-08-29  5:30 ` [PATCH v6 7/7] drm/vkms Add hotplug support via configfs to VKMS Brandon Pollack
2023-09-20 18:03   ` Helen Koike
2023-09-21  3:44     ` Brandon Ross Pollack
2024-04-30  8:27   ` Daniel Vetter
2023-09-01  9:32 ` [PATCH v6 0/7] Adds support for ConfigFS to VKMS! Marius Vlad
2024-04-30  8:36 ` Daniel Vetter
2024-05-08 18:17   ` José Expósito
2024-05-09 22:18     ` Jim Shargo
2024-05-10 16:19       ` Louis Chauvet
2024-05-13  8:08         ` José Expósito
2024-05-13  9:03           ` Marius Vlad
2024-05-13 16:23             ` José Expósito
2024-05-17 16:00               ` Louis Chauvet
2024-05-21 12:25           ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjCjlCmMQjOzrdD0@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=brpol@chromium.org \
    --cc=corbet@lwn.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=hirono@chromium.org \
    --cc=jshargo@chromium.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mairacanal@riseup.net \
    --cc=marius.vlad@collabora.com \
    --cc=mduggan@chromium.org \
    --cc=melissa.srw@gmail.com \
    --cc=mripard@kernel.org \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).