linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Louis Chauvet <louis.chauvet@bootlin.com>,
	Haneen Mohammed <hamohammed.sa@gmail.com>,
	Simona Vetter <simona@ffwll.ch>,
	Melissa Wen <melissa.srw@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>,
	jose.exposito89@gmail.com, Jonathan Corbet <corbet@lwn.net>
Cc: victoria@system76.com, sebastian.wick@redhat.com,
	victoria@system76.com, airlied@gmail.com,
	thomas.petazzoni@bootlin.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	Louis Chauvet <louis.chauvet@bootlin.com>
Subject: Re: [PATCH 01/22] drm/vkms: Introduce config for plane name
Date: Mon, 27 Oct 2025 12:15:29 +0200	[thread overview]
Message-ID: <5c77c4eaff1dc746243118cd9130299ba1dd2136@intel.com> (raw)
In-Reply-To: <20251018-vkms-all-config-v1-1-a7760755d92d@bootlin.com>

On Sat, 18 Oct 2025, Louis Chauvet <louis.chauvet@bootlin.com> wrote:
> As planes can have a name in DRM, prepare VKMS to configure it using
> ConfigFS.
>
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
>  drivers/gpu/drm/vkms/vkms_config.c |  4 ++++
>  drivers/gpu/drm/vkms/vkms_config.h | 26 ++++++++++++++++++++++++++
>  drivers/gpu/drm/vkms/vkms_drv.h    |  5 +++--
>  drivers/gpu/drm/vkms/vkms_output.c |  6 +-----
>  drivers/gpu/drm/vkms/vkms_plane.c  |  6 ++++--
>  5 files changed, 38 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_config.c b/drivers/gpu/drm/vkms/vkms_config.c
> index f8394a063ecf..ed172f800685 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.c
> +++ b/drivers/gpu/drm/vkms/vkms_config.c
> @@ -350,6 +350,8 @@ static int vkms_config_show(struct seq_file *m, void *data)
>  		seq_puts(m, "plane:\n");
>  		seq_printf(m, "\ttype=%d\n",
>  			   vkms_config_plane_get_type(plane_cfg));
> +		seq_printf(m, "\tname=%s\n",
> +			   vkms_config_plane_get_name(plane_cfg));
>  	}
>  
>  	vkms_config_for_each_crtc(vkmsdev->config, crtc_cfg) {
> @@ -390,6 +392,7 @@ struct vkms_config_plane *vkms_config_create_plane(struct vkms_config *config)
>  
>  	plane_cfg->config = config;
>  	vkms_config_plane_set_type(plane_cfg, DRM_PLANE_TYPE_OVERLAY);
> +	vkms_config_plane_set_name(plane_cfg, NULL);
>  	xa_init_flags(&plane_cfg->possible_crtcs, XA_FLAGS_ALLOC);
>  
>  	list_add_tail(&plane_cfg->link, &config->planes);
> @@ -402,6 +405,7 @@ void vkms_config_destroy_plane(struct vkms_config_plane *plane_cfg)
>  {
>  	xa_destroy(&plane_cfg->possible_crtcs);
>  	list_del(&plane_cfg->link);
> +	kfree_const(plane_cfg->name);
>  	kfree(plane_cfg);
>  }
>  EXPORT_SYMBOL_IF_KUNIT(vkms_config_destroy_plane);
> diff --git a/drivers/gpu/drm/vkms/vkms_config.h b/drivers/gpu/drm/vkms/vkms_config.h
> index 4c8d668e7ef8..b69c35097ba0 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.h
> +++ b/drivers/gpu/drm/vkms/vkms_config.h
> @@ -35,6 +35,7 @@ struct vkms_config {
>   *
>   * @link: Link to the others planes in vkms_config
>   * @config: The vkms_config this plane belongs to
> + * @name: Name of the plane
>   * @type: Type of the plane. The creator of configuration needs to ensures that
>   *        at least one primary plane is present.
>   * @possible_crtcs: Array of CRTCs that can be used with this plane
> @@ -47,6 +48,7 @@ struct vkms_config_plane {
>  	struct list_head link;
>  	struct vkms_config *config;
>  
> +	const char *name;
>  	enum drm_plane_type type;
>  	struct xarray possible_crtcs;
>  
> @@ -288,6 +290,30 @@ vkms_config_plane_set_type(struct vkms_config_plane *plane_cfg,
>  	plane_cfg->type = type;
>  }
>  
> +/**
> + * vkms_config_plane_set_name() - Set the plane name
> + * @plane_cfg: Plane to set the name to
> + * @name: New plane name. The name is copied.
> + */
> +static inline void
> +vkms_config_plane_set_name(struct vkms_config_plane *plane_cfg,
> +			   const char *name)
> +{
> +	if (plane_cfg->name)
> +		kfree_const(plane_cfg->name);
> +	plane_cfg->name = kstrdup_const(name, GFP_KERNEL);
> +}
> +
> +/**
> + * vkms_config_plane_get_name - Get the plane name
> + * @plane_cfg: Plane to get the name from
> + */
> +static inline const char *
> +vkms_config_plane_get_name(struct vkms_config_plane *plane_cfg)
> +{
> +	return plane_cfg->name;
> +}

What's with the abundance of static inlines being added in this header?

You'll have more files including this header, and this header will be
including more files the more static inline functionality you add, and
eventually everything just ends up including way too much. That's what
happens with static inlines, and it's a bunch of tedious refactoring
later to clean it up.


BR,
Jani.


> +
>  /**
>   * vkms_config_plane_attach_crtc - Attach a plane to a CRTC
>   * @plane_cfg: Plane to attach
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> index db260df1d4f6..9ad286f043b5 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> @@ -225,6 +225,7 @@ struct vkms_output {
>  };
>  
>  struct vkms_config;
> +struct vkms_config_plane;
>  
>  /**
>   * struct vkms_device - Description of a VKMS device
> @@ -298,10 +299,10 @@ int vkms_output_init(struct vkms_device *vkmsdev);
>   * vkms_plane_init() - Initialize a plane
>   *
>   * @vkmsdev: VKMS device containing the plane
> - * @type: type of plane to initialize
> + * @config: plane configuration
>   */
>  struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> -				   enum drm_plane_type type);
> +				   struct vkms_config_plane *config);
>  
>  /* CRC Support */
>  const char *const *vkms_get_crc_sources(struct drm_crtc *crtc,
> diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> index 2ee3749e2b28..22208d02afa4 100644
> --- a/drivers/gpu/drm/vkms/vkms_output.c
> +++ b/drivers/gpu/drm/vkms/vkms_output.c
> @@ -19,11 +19,7 @@ int vkms_output_init(struct vkms_device *vkmsdev)
>  		return -EINVAL;
>  
>  	vkms_config_for_each_plane(vkmsdev->config, plane_cfg) {
> -		enum drm_plane_type type;
> -
> -		type = vkms_config_plane_get_type(plane_cfg);
> -
> -		plane_cfg->plane = vkms_plane_init(vkmsdev, type);
> +		plane_cfg->plane = vkms_plane_init(vkmsdev, plane_cfg);
>  		if (IS_ERR(plane_cfg->plane)) {
>  			DRM_DEV_ERROR(dev->dev, "Failed to init vkms plane\n");
>  			return PTR_ERR(plane_cfg->plane);
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index e592e47a5736..263376686794 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -11,6 +11,7 @@
>  
>  #include "vkms_drv.h"
>  #include "vkms_formats.h"
> +#include "vkms_config.h"
>  
>  static const u32 vkms_formats[] = {
>  	DRM_FORMAT_ARGB8888,
> @@ -217,7 +218,7 @@ static const struct drm_plane_helper_funcs vkms_plane_helper_funcs = {
>  };
>  
>  struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> -				   enum drm_plane_type type)
> +				   struct vkms_config_plane *config)
>  {
>  	struct drm_device *dev = &vkmsdev->drm;
>  	struct vkms_plane *plane;
> @@ -225,7 +226,8 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
>  	plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 0,
>  					   &vkms_plane_funcs,
>  					   vkms_formats, ARRAY_SIZE(vkms_formats),
> -					   NULL, type, NULL);
> +					   NULL, vkms_config_plane_get_type(config),
> +					   vkms_config_plane_get_name(config));
>  	if (IS_ERR(plane))
>  		return plane;

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2025-10-27 10:15 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-18  2:01 [PATCH 00/22] VKMS: Introduce multiple configFS attributes Louis Chauvet
2025-10-18  2:01 ` [PATCH 01/22] drm/vkms: Introduce config for plane name Louis Chauvet
2025-10-24 11:16   ` José Expósito
2025-10-27 10:15   ` Jani Nikula [this message]
2025-10-18  2:01 ` [PATCH 02/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-24 11:20   ` José Expósito
2025-10-18  2:01 ` [PATCH 03/22] drm/vkms: Introduce config for plane rotation Louis Chauvet
2025-10-24 11:53   ` José Expósito
2025-10-18  2:01 ` [PATCH 04/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-24 14:50   ` José Expósito
2025-10-18  2:01 ` [PATCH 05/22] drm/vkms: Introduce config for plane color encoding Louis Chauvet
2025-10-24 15:14   ` José Expósito
2025-10-18  2:01 ` [PATCH 06/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-24 15:16   ` José Expósito
2025-10-18  2:01 ` [PATCH 07/22] drm/vkms: Introduce config for plane color range Louis Chauvet
2025-10-24 15:25   ` José Expósito
2025-10-18  2:01 ` [PATCH 08/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-24 15:27   ` José Expósito
2025-10-18  2:01 ` [PATCH 09/22] drm/vkms: Introduce config for plane format Louis Chauvet
2025-10-24 15:44   ` José Expósito
2025-10-18  2:01 ` [PATCH 10/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-27  8:55   ` José Expósito
2025-10-18  2:01 ` [PATCH 11/22] drm/vkms: Properly render plane using their zpos Louis Chauvet
2025-10-18  2:01 ` [PATCH 12/22] drm/vkms: Introduce config for plane zpos property Louis Chauvet
2025-10-27  9:12   ` José Expósito
2025-10-18  2:01 ` [PATCH 13/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-27  9:19   ` José Expósito
2025-10-18  2:01 ` [PATCH 14/22] drm/vkms: Introduce config for connector type Louis Chauvet
2025-10-27  9:27   ` José Expósito
2025-10-18  2:01 ` [PATCH 15/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-18  2:01 ` [PATCH 16/22] drm/vkms: Introduce config for connector supported colorspace Louis Chauvet
2025-10-27  9:35   ` José Expósito
2025-10-27  9:38   ` José Expósito
2025-10-18  2:01 ` [PATCH 17/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-18  2:01 ` [PATCH 18/22] drm/vkms: Introduce config for connector EDID Louis Chauvet
2025-10-27 10:02   ` José Expósito
2025-10-18  2:01 ` [PATCH 19/22] drm/vkms: Introduce configfs " Louis Chauvet
2025-10-27 10:16   ` José Expósito
2025-10-27 17:18     ` Louis Chauvet
2025-10-18  2:01 ` [PATCH 20/22] drm/vkms: Store the enabled/disabled status for connector Louis Chauvet
2025-10-27 14:52   ` José Expósito
2025-10-18  2:01 ` [PATCH 21/22] drm/vkms: Allow to hot-add connectors Louis Chauvet
2025-10-27 15:01   ` José Expósito
2025-10-18  2:01 ` [PATCH 22/22] drm/vkms: Allows the creation of connector at runtime Louis Chauvet
2025-10-27 15:17   ` José Expósito
2025-10-27 15:22 ` [PATCH 00/22] VKMS: Introduce multiple configFS attributes José Expósito
2025-10-27 15:53   ` Louis Chauvet
2025-10-28  7:32     ` José Expósito

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=5c77c4eaff1dc746243118cd9130299ba1dd2136@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=jose.exposito89@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louis.chauvet@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=melissa.srw@gmail.com \
    --cc=mripard@kernel.org \
    --cc=sebastian.wick@redhat.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tzimmermann@suse.de \
    --cc=victoria@system76.com \
    /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 NNTP newsgroup(s).