All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: document better that drivers shouldn't use drm_minor directly
@ 2023-01-04 21:17 Daniel Vetter
  2023-01-05  7:38 ` Maxime Ripard
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Daniel Vetter @ 2023-01-04 21:17 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Vetter, Maíra Canal, Melissa Wen, Maxime Ripard,
	Rodrigo Vivi, Daniel Vetter, Wambui Karuga

The documentation for struct drm_minor already states this, but that's
not always that easy to find.

Also due to historical reasons we still have the minor-centric (like
drm_debugfs_create_files), but since this is now getting fixed we can
put a few more pointers in place as to how this should be done
ideally.

Motvated by some discussion with Rodrigo on irc about how drm/xe
should lay out its sysfs interfaces.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Maíra Canal <mcanal@igalia.com>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Melissa Wen <mwen@igalia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 include/drm/drm_device.h | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 9923c7a6885e..b40e07e004ee 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -87,10 +87,23 @@ struct drm_device {
 	 */
 	void *dev_private;
 
-	/** @primary: Primary node */
+	/**
+	 * @primary:
+	 *
+	 * Primary node. Drivers should not interact with this
+	 * directly. debugfs interface can be registered with
+	 * drm_debugfs_add_file(), and sysfs should be directly added on the
+	 * hardwire struct device @dev.
+	 */
 	struct drm_minor *primary;
 
-	/** @render: Render node */
+	/**
+	 * @render:
+	 *
+	 * Render node. Drivers should not interact with this directly ever.
+	 * Drivers should not expose any additional interfaces in debugfs or
+	 * sysfs on thise node.
+	 */
 	struct drm_minor *render;
 
 	/**
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm: document better that drivers shouldn't use drm_minor directly
  2023-01-04 21:17 [PATCH] drm: document better that drivers shouldn't use drm_minor directly Daniel Vetter
@ 2023-01-05  7:38 ` Maxime Ripard
  2023-01-05 10:21 ` Maíra Canal
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2023-01-05  7:38 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Maíra Canal, DRI Development, Melissa Wen, Rodrigo Vivi,
	Daniel Vetter, Wambui Karuga

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

On Wed, Jan 04, 2023 at 10:17:54PM +0100, Daniel Vetter wrote:
> The documentation for struct drm_minor already states this, but that's
> not always that easy to find.
> 
> Also due to historical reasons we still have the minor-centric (like
> drm_debugfs_create_files), but since this is now getting fixed we can
> put a few more pointers in place as to how this should be done
> ideally.
> 
> Motvated by some discussion with Rodrigo on irc about how drm/xe

  ^ Motivated

> should lay out its sysfs interfaces.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Maíra Canal <mcanal@igalia.com>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Melissa Wen <mwen@igalia.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Acked-by: Maxime Ripard <maxime@cerno.tech>

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm: document better that drivers shouldn't use drm_minor directly
  2023-01-04 21:17 [PATCH] drm: document better that drivers shouldn't use drm_minor directly Daniel Vetter
  2023-01-05  7:38 ` Maxime Ripard
@ 2023-01-05 10:21 ` Maíra Canal
  2023-01-05 12:07 ` Melissa Wen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Maíra Canal @ 2023-01-05 10:21 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Melissa Wen, Daniel Vetter, Wambui Karuga, Maxime Ripard, Rodrigo Vivi

On 1/4/23 18:17, Daniel Vetter wrote:
> The documentation for struct drm_minor already states this, but that's
> not always that easy to find.
> 
> Also due to historical reasons we still have the minor-centric (like
> drm_debugfs_create_files), but since this is now getting fixed we can
> put a few more pointers in place as to how this should be done
> ideally.
> 
> Motvated by some discussion with Rodrigo on irc about how drm/xe
> should lay out its sysfs interfaces.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Maíra Canal <mcanal@igalia.com>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Melissa Wen <mwen@igalia.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>   include/drm/drm_device.h | 17 +++++++++++++++--
>   1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> index 9923c7a6885e..b40e07e004ee 100644
> --- a/include/drm/drm_device.h
> +++ b/include/drm/drm_device.h
> @@ -87,10 +87,23 @@ struct drm_device {
>   	 */
>   	void *dev_private;
>   
> -	/** @primary: Primary node */
> +	/**
> +	 * @primary:
> +	 *
> +	 * Primary node. Drivers should not interact with this
> +	 * directly. debugfs interface can be registered with
> +	 * drm_debugfs_add_file(), and sysfs should be directly added on the
> +	 * hardwire struct device @dev.
> +	 */
>   	struct drm_minor *primary;
>   
> -	/** @render: Render node */
> +	/**
> +	 * @render:
> +	 *
> +	 * Render node. Drivers should not interact with this directly ever.
> +	 * Drivers should not expose any additional interfaces in debugfs or
> +	 * sysfs on thise node.

I believe you meant s/thise/this.

Apart from this small nit,

Reviewed-by: Maíra Canal <mcanal@igalia.com>

Best Regards,
- Maíra Canal

> +	 */
>   	struct drm_minor *render;
>   
>   	/**

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm: document better that drivers shouldn't use drm_minor directly
  2023-01-04 21:17 [PATCH] drm: document better that drivers shouldn't use drm_minor directly Daniel Vetter
  2023-01-05  7:38 ` Maxime Ripard
  2023-01-05 10:21 ` Maíra Canal
@ 2023-01-05 12:07 ` Melissa Wen
  2023-01-05 12:27 ` Rodrigo Vivi
  2023-01-05 12:39 ` Jani Nikula
  4 siblings, 0 replies; 8+ messages in thread
From: Melissa Wen @ 2023-01-05 12:07 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Maíra Canal, DRI Development, Maxime Ripard, Rodrigo Vivi,
	Daniel Vetter, Wambui Karuga

[-- Attachment #1: Type: text/plain, Size: 1889 bytes --]

On 01/04, Daniel Vetter wrote:
> The documentation for struct drm_minor already states this, but that's
> not always that easy to find.
> 
> Also due to historical reasons we still have the minor-centric (like
> drm_debugfs_create_files), but since this is now getting fixed we can
> put a few more pointers in place as to how this should be done
> ideally.
> 
> Motvated by some discussion with Rodrigo on irc about how drm/xe
> should lay out its sysfs interfaces.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Maíra Canal <mcanal@igalia.com>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Melissa Wen <mwen@igalia.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  include/drm/drm_device.h | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> index 9923c7a6885e..b40e07e004ee 100644
> --- a/include/drm/drm_device.h
> +++ b/include/drm/drm_device.h
> @@ -87,10 +87,23 @@ struct drm_device {
>  	 */
>  	void *dev_private;
>  
> -	/** @primary: Primary node */
> +	/**
> +	 * @primary:
> +	 *
> +	 * Primary node. Drivers should not interact with this
> +	 * directly. debugfs interface can be registered with
> +	 * drm_debugfs_add_file(), and sysfs should be directly added on the
> +	 * hardwire struct device @dev.
> +	 */
>  	struct drm_minor *primary;
>  
> -	/** @render: Render node */
> +	/**
> +	 * @render:
> +	 *
> +	 * Render node. Drivers should not interact with this directly ever.
> +	 * Drivers should not expose any additional interfaces in debugfs or
> +	 * sysfs on thise node.
> +	 */
>  	struct drm_minor *render;
>  
>  	/**

yeah, with those typos fixed, LGTM.

Reviewed-by: Melissa Wen <mwen@igalia.com>

Thanks!

> -- 
> 2.37.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm: document better that drivers shouldn't use drm_minor directly
  2023-01-04 21:17 [PATCH] drm: document better that drivers shouldn't use drm_minor directly Daniel Vetter
                   ` (2 preceding siblings ...)
  2023-01-05 12:07 ` Melissa Wen
@ 2023-01-05 12:27 ` Rodrigo Vivi
  2023-01-05 12:39 ` Jani Nikula
  4 siblings, 0 replies; 8+ messages in thread
From: Rodrigo Vivi @ 2023-01-05 12:27 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Maíra Canal, DRI Development, Melissa Wen, Maxime Ripard,
	Daniel Vetter, Wambui Karuga

On Wed, Jan 04, 2023 at 10:17:54PM +0100, Daniel Vetter wrote:
> The documentation for struct drm_minor already states this, but that's
> not always that easy to find.
> 
> Also due to historical reasons we still have the minor-centric (like
> drm_debugfs_create_files), but since this is now getting fixed we can
> put a few more pointers in place as to how this should be done
> ideally.
> 
> Motvated by some discussion with Rodrigo on irc about how drm/xe
> should lay out its sysfs interfaces.

Thank you!

Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> 
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Maíra Canal <mcanal@igalia.com>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Melissa Wen <mwen@igalia.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  include/drm/drm_device.h | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> index 9923c7a6885e..b40e07e004ee 100644
> --- a/include/drm/drm_device.h
> +++ b/include/drm/drm_device.h
> @@ -87,10 +87,23 @@ struct drm_device {
>  	 */
>  	void *dev_private;
>  
> -	/** @primary: Primary node */
> +	/**
> +	 * @primary:
> +	 *
> +	 * Primary node. Drivers should not interact with this
> +	 * directly. debugfs interface can be registered with
> +	 * drm_debugfs_add_file(), and sysfs should be directly added on the
> +	 * hardwire struct device @dev.
> +	 */
>  	struct drm_minor *primary;
>  
> -	/** @render: Render node */
> +	/**
> +	 * @render:
> +	 *
> +	 * Render node. Drivers should not interact with this directly ever.
> +	 * Drivers should not expose any additional interfaces in debugfs or
> +	 * sysfs on thise node.
> +	 */
>  	struct drm_minor *render;
>  
>  	/**
> -- 
> 2.37.2
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm: document better that drivers shouldn't use drm_minor directly
  2023-01-04 21:17 [PATCH] drm: document better that drivers shouldn't use drm_minor directly Daniel Vetter
                   ` (3 preceding siblings ...)
  2023-01-05 12:27 ` Rodrigo Vivi
@ 2023-01-05 12:39 ` Jani Nikula
  2023-01-05 13:39   ` Daniel Vetter
  4 siblings, 1 reply; 8+ messages in thread
From: Jani Nikula @ 2023-01-05 12:39 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Daniel Vetter, Maíra Canal, Melissa Wen, Maxime Ripard,
	Rodrigo Vivi, Daniel Vetter, Wambui Karuga

On Wed, 04 Jan 2023, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> The documentation for struct drm_minor already states this, but that's
> not always that easy to find.
>
> Also due to historical reasons we still have the minor-centric (like
> drm_debugfs_create_files), but since this is now getting fixed we can
> put a few more pointers in place as to how this should be done
> ideally.

Care to expand on the vague "this is now getting fixed" part a bit?

I've seen the "Introduce debugfs device-centered functions" series from
Maíra, but that doesn't solve everything. Not everything can use
drm_debugfs_add_file().

BR,
Jani.

>
> Motvated by some discussion with Rodrigo on irc about how drm/xe
> should lay out its sysfs interfaces.
>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Maíra Canal <mcanal@igalia.com>
> Cc: Maxime Ripard <maxime@cerno.tech>
> Cc: Melissa Wen <mwen@igalia.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  include/drm/drm_device.h | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> index 9923c7a6885e..b40e07e004ee 100644
> --- a/include/drm/drm_device.h
> +++ b/include/drm/drm_device.h
> @@ -87,10 +87,23 @@ struct drm_device {
>  	 */
>  	void *dev_private;
>  
> -	/** @primary: Primary node */
> +	/**
> +	 * @primary:
> +	 *
> +	 * Primary node. Drivers should not interact with this
> +	 * directly. debugfs interface can be registered with
> +	 * drm_debugfs_add_file(), and sysfs should be directly added on the
> +	 * hardwire struct device @dev.
> +	 */
>  	struct drm_minor *primary;
>  
> -	/** @render: Render node */
> +	/**
> +	 * @render:
> +	 *
> +	 * Render node. Drivers should not interact with this directly ever.
> +	 * Drivers should not expose any additional interfaces in debugfs or
> +	 * sysfs on thise node.
> +	 */
>  	struct drm_minor *render;
>  
>  	/**

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drm: document better that drivers shouldn't use drm_minor directly
  2023-01-05 12:39 ` Jani Nikula
@ 2023-01-05 13:39   ` Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2023-01-05 13:39 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Daniel Vetter, Maíra Canal, DRI Development, Melissa Wen,
	Maxime Ripard, Rodrigo Vivi, Daniel Vetter, Wambui Karuga

On Thu, Jan 05, 2023 at 02:39:21PM +0200, Jani Nikula wrote:
> On Wed, 04 Jan 2023, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > The documentation for struct drm_minor already states this, but that's
> > not always that easy to find.
> >
> > Also due to historical reasons we still have the minor-centric (like
> > drm_debugfs_create_files), but since this is now getting fixed we can
> > put a few more pointers in place as to how this should be done
> > ideally.
> 
> Care to expand on the vague "this is now getting fixed" part a bit?
> 
> I've seen the "Introduce debugfs device-centered functions" series from
> Maíra, but that doesn't solve everything. Not everything can use
> drm_debugfs_add_file().

Yeah this is only step 1 of the entire project, there's still more in the
todo entry:

https://dri.freedesktop.org/docs/drm/gpu/todo.html#clean-up-the-debugfs-support

We need the same trick on the connector and crtc too. I think with those
we should have most things covered?
-Daniel

> 
> BR,
> Jani.
> 
> >
> > Motvated by some discussion with Rodrigo on irc about how drm/xe
> > should lay out its sysfs interfaces.
> >
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > Cc: Maíra Canal <mcanal@igalia.com>
> > Cc: Maxime Ripard <maxime@cerno.tech>
> > Cc: Melissa Wen <mwen@igalia.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  include/drm/drm_device.h | 17 +++++++++++++++--
> >  1 file changed, 15 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
> > index 9923c7a6885e..b40e07e004ee 100644
> > --- a/include/drm/drm_device.h
> > +++ b/include/drm/drm_device.h
> > @@ -87,10 +87,23 @@ struct drm_device {
> >  	 */
> >  	void *dev_private;
> >  
> > -	/** @primary: Primary node */
> > +	/**
> > +	 * @primary:
> > +	 *
> > +	 * Primary node. Drivers should not interact with this
> > +	 * directly. debugfs interface can be registered with
> > +	 * drm_debugfs_add_file(), and sysfs should be directly added on the
> > +	 * hardwire struct device @dev.
> > +	 */
> >  	struct drm_minor *primary;
> >  
> > -	/** @render: Render node */
> > +	/**
> > +	 * @render:
> > +	 *
> > +	 * Render node. Drivers should not interact with this directly ever.
> > +	 * Drivers should not expose any additional interfaces in debugfs or
> > +	 * sysfs on thise node.
> > +	 */
> >  	struct drm_minor *render;
> >  
> >  	/**
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] drm: document better that drivers shouldn't use drm_minor directly
@ 2023-01-09 16:46 Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2023-01-09 16:46 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Vetter, Maíra Canal, Melissa Wen, Maxime Ripard,
	Rodrigo Vivi, Daniel Vetter, Wambui Karuga

The documentation for struct drm_minor already states this, but that's
not always that easy to find.

Also due to historical reasons we still have the minor-centric (like
drm_debugfs_create_files), but since this is now getting fixed we can
put a few more pointers in place as to how this should be done
ideally. Note that debugfs isn't there yet for all cases (debugfs
files on kms objects like crtc/connector aren't supported, neither
debugfs files with full fops), so the debugfs side of this is still
rather aspirational and more for new users than converting everything
existing. todo.rst covers the additional work needed already.

Motivated by some discussion with Rodrigo on irc about how drm/xe
should lay out its sysfs interfaces.

v2: Make the debugfs situation clearer in the commit message, but
don't elaborate more in the actual kerneldoc to avoid distracting from
the main message around sysfs (Jani)

Also fix some typos.

Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Maíra Canal <mcanal@igalia.com>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Melissa Wen <mwen@igalia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 include/drm/drm_device.h | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index a68c6a312b46..7cf4afae2e79 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -87,10 +87,23 @@ struct drm_device {
 	 */
 	void *dev_private;
 
-	/** @primary: Primary node */
+	/**
+	 * @primary:
+	 *
+	 * Primary node. Drivers should not interact with this
+	 * directly. debugfs interfaces can be registered with
+	 * drm_debugfs_add_file(), and sysfs should be directly added on the
+	 * hardware (and not character device node) struct device @dev.
+	 */
 	struct drm_minor *primary;
 
-	/** @render: Render node */
+	/**
+	 * @render:
+	 *
+	 * Render node. Drivers should not interact with this directly ever.
+	 * Drivers should not expose any additional interfaces in debugfs or
+	 * sysfs on this node.
+	 */
 	struct drm_minor *render;
 
 	/** @accel: Compute Acceleration node */
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-01-09 16:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 21:17 [PATCH] drm: document better that drivers shouldn't use drm_minor directly Daniel Vetter
2023-01-05  7:38 ` Maxime Ripard
2023-01-05 10:21 ` Maíra Canal
2023-01-05 12:07 ` Melissa Wen
2023-01-05 12:27 ` Rodrigo Vivi
2023-01-05 12:39 ` Jani Nikula
2023-01-05 13:39   ` Daniel Vetter
2023-01-09 16:46 Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.