Re: [PATCH v4] Documentation: gpu: Mention the requirements for new properties

2021-07-07 Thread Pekka Paalanen
On Tue, 6 Jul 2021 18:42:41 +0200
Maxime Ripard  wrote:

> On Tue, Jul 06, 2021 at 12:37:23PM +0300, Pekka Paalanen wrote:
> > > > > +- It must provide a generic helper in the core code to register that
> > > > > +  property on the object it attaches to.
> > > > > +
> > > > > +- Its content must be decoded by the core and provided in the 
> > > > > object's
> > > > > +  associated state structure. That includes anything drivers might 
> > > > > want to
> > > > > +  precompute, like :c:type:`struct drm_clip_rect ` 
> > > > > for planes.
> > > > > +
> > > > > +- An IGT test must be submitted where reasonable.
> > > > 
> > > > Would it be too much to replace "where reasonable" with "if it is at
> > > > all possible to write a test."?
> > > > 
> > > > > +
> > > > 
> > > > How about adding the following somewhere?
> > > > 
> > > > - The initial state of the property (set during driver initialization)
> > > >   must match how the driver+hardware behaved before introducing this
> > > >   property. It may be some fixed value or it may be inherited from e.g.
> > > >   the firmware that booted the system. How the initial state is
> > > >   determined must also be documented, that is, where does it come from.
> > > > 
> > > > The initial state must not be called "default", because I want to
> > > > reserve the term default for something else if possible: the phrase
> > > > "reset everything to defaults", which is a whole another discussion.
> > > 
> > > I've taken into account your previous comments, thanks
> > >   
> > > > How about also saying that fbcon/fbdev must set this property when
> > > > taking over? That sounds to be like a common omission leading to funky
> > > > KMS state in fbcon. The value fbdev sets it to only needs to make
> > > > sense to fbdev, and it does not need to be ~~the initial value~~ nor the
> > > > default value. Or are we hoping to kill fbcon in favor of a userspace
> > > > kmscon soon? ;-)
> > > > 
> > > > Ooh, maybe the KMS property documentation should also say what value
> > > > fbdev will set the property to. That's kind of UABI, because userspace
> > > > probably implicitly relies on it in many cases. ...which means fbdev
> > > > should set the property to its initial value, otherwise userspace will
> > > > break.
> > > 
> > > I'm not sure about this one: fbdev and fbcon are still optional features
> > > of the kernel and can be disabled at the user discretion. Having any
> > > part of the user-space rely on the fbdev behavior seems a bit broken,
> > > especially when we have a mechanism to retrieve the state when the
> > > application starts.  
> > 
> > yes, exactly that is why fbdev/fbcon should reset the properties to
> > their initial values. You would not want userspace inheriting a
> > different KMS state with vs. without fbcon when it starts.  
> 
> I'm not sure I'm following you when fbdev/fbcon should reset these
> properties. When a master takes over?

Hi,

when fbcon/fbdev takes over. If it doesn't reset things like GAMMA
LUT, it's possible it won't be readable even though nothing fails.

(Let's say you fumble with an xrandr incantation and manage to set a
LUT that turns everything into a single shade of green or something.
How do you recover?)

When a userspace KMS client hands off to another userspace KMS client,
fbcon/fbdev should not do anything. If it did, that would cause extra
flicker.

I'm assuming fbcon/fbdev already implement all the necessary
mechanisms, but they just don't poke at all the KMS properties
necessary, as is evident from e.g. Michel Dänzer's testing seeing wrong
colors in fbcon after a userspace KMS client changed GAMMA or DEGAMMA
once.

Handling this properly would offer an escape hatch without reboot when
something goes wrong in a display server. It's not a fix for userspace
KMS client handing off to another userspace KMS client, for that we
need something else.

> If we consider fbdev as any KMS client, isn't it a fundamental change
> with how it's currently done? I haven't seen anywhere that a compositor
> (or any client for that matter) should put the KMS device in the same
> state that it started it with. In case of a crash it would be fairly
> difficult to achieve.

It has long been agreed IMO but never implemented anywhere AFAIK that a
userspace KMS client should fully reset the whole KMS state to the KMS
state it started with when it *comes back* after being switched away. I
have talked with Daniel Vetter about this several times over the years.
The problem with resetting the full KMS state is what to do with those
KMS properties the KMS client does not understand but are exposed by the
driver.

When a userspace KMS client switches out or quits, what is implemented
and what should be implemented differs again. I believe that KMS
clients of today do not change anything, so that the number of modesets
is minimized. This is sufficient if the KMS client didn't use any less
commonly used KMS properties. It's also consistent

Re: [PATCH v4] Documentation: gpu: Mention the requirements for new properties

2021-07-06 Thread Maxime Ripard
On Tue, Jul 06, 2021 at 12:37:23PM +0300, Pekka Paalanen wrote:
> > > > +- It must provide a generic helper in the core code to register that
> > > > +  property on the object it attaches to.
> > > > +
> > > > +- Its content must be decoded by the core and provided in the object's
> > > > +  associated state structure. That includes anything drivers might 
> > > > want to
> > > > +  precompute, like :c:type:`struct drm_clip_rect ` for 
> > > > planes.
> > > > +
> > > > +- An IGT test must be submitted where reasonable.  
> > > 
> > > Would it be too much to replace "where reasonable" with "if it is at
> > > all possible to write a test."?
> > >   
> > > > +  
> > > 
> > > How about adding the following somewhere?
> > > 
> > > - The initial state of the property (set during driver initialization)
> > >   must match how the driver+hardware behaved before introducing this
> > >   property. It may be some fixed value or it may be inherited from e.g.
> > >   the firmware that booted the system. How the initial state is
> > >   determined must also be documented, that is, where does it come from.
> > > 
> > > The initial state must not be called "default", because I want to
> > > reserve the term default for something else if possible: the phrase
> > > "reset everything to defaults", which is a whole another discussion.  
> > 
> > I've taken into account your previous comments, thanks
> > 
> > > How about also saying that fbcon/fbdev must set this property when
> > > taking over? That sounds to be like a common omission leading to funky
> > > KMS state in fbcon. The value fbdev sets it to only needs to make
> > > sense to fbdev, and it does not need to be ~~the initial value~~ nor the
> > > default value. Or are we hoping to kill fbcon in favor of a userspace
> > > kmscon soon? ;-)
> > > 
> > > Ooh, maybe the KMS property documentation should also say what value
> > > fbdev will set the property to. That's kind of UABI, because userspace
> > > probably implicitly relies on it in many cases. ...which means fbdev
> > > should set the property to its initial value, otherwise userspace will
> > > break.  
> > 
> > I'm not sure about this one: fbdev and fbcon are still optional features
> > of the kernel and can be disabled at the user discretion. Having any
> > part of the user-space rely on the fbdev behavior seems a bit broken,
> > especially when we have a mechanism to retrieve the state when the
> > application starts.
> 
> yes, exactly that is why fbdev/fbcon should reset the properties to
> their initial values. You would not want userspace inheriting a
> different KMS state with vs. without fbcon when it starts.

I'm not sure I'm following you when fbdev/fbcon should reset these
properties. When a master takes over?

If we consider fbdev as any KMS client, isn't it a fundamental change
with how it's currently done? I haven't seen anywhere that a compositor
(or any client for that matter) should put the KMS device in the same
state that it started it with. In case of a crash it would be fairly
difficult to achieve.

> Retrieving the current KMS state is useless if the current KMS state is
> somehow wonky and the application does not understand that specific KMS
> property that is wonky. It cannot set the property to any value other
> than it already had without user intervention.

Yeah, that's true. But the same could be said if you switch from one
client to the other for example, at the moment there's no guarantee that
the first one didn't change a property to a value you don't expect in
the second. Unless we manage to tie that somehow to a first open of the
device?

> I'd say fbcon causing all KMS state to be reset is a quality of life
> thing. It's possible to live without by rebooting, but it would
> certainly make at least developers' and testers' life easier until we
> get the real "reset KMS" knob (which fbcon could then use too).
> 
> Besides, even if it is broken for userspace to rely on the KMS state
> set by fbcon/fbdev, userspace is already doing that and not on purpose
> because new KMS properties get added in the kernel. I would bet that
> there is not a single userspace program that would actually set all KMS
> properties that drivers might expose. So they are depending on
> inherited KMS state, which could be left by driver initialization, by
> fbdev/fbcon, or by any other userspace.
> 
> But yeah, this idea is something new, so don't let this discussion
> delay landing the docs.

Ack, I've sent a new version

Thanks!
Maxime


signature.asc
Description: PGP signature


Re: [PATCH v4] Documentation: gpu: Mention the requirements for new properties

2021-07-06 Thread Pekka Paalanen
On Tue, 6 Jul 2021 10:52:02 +0200
Maxime Ripard  wrote:

> Hi Pekka,
> 
> On Thu, Jun 17, 2021 at 11:20:36AM +0300, Pekka Paalanen wrote:
> > On Wed, 16 Jun 2021 16:38:42 +0200
> > Maxime Ripard  wrote:
> >   
> > > New KMS properties come with a bunch of requirements to avoid each
> > > driver from running their own, inconsistent, set of properties,
> > > eventually leading to issues like property conflicts, inconsistencies
> > > between drivers and semantics, etc.
> > > 
> > > Let's document what we expect.
> > > 
> > > Cc: Alexandre Belloni 
> > > Cc: Alexandre Torgue 
> > > Cc: Alex Deucher 
> > > Cc: Alison Wang 
> > > Cc: Alyssa Rosenzweig 
> > > Cc: Andrew Jeffery 
> > > Cc: Andrzej Hajda 
> > > Cc: Anitha Chrisanthus 
> > > Cc: Benjamin Gaignard 
> > > Cc: Ben Skeggs 
> > > Cc: Boris Brezillon 
> > > Cc: Brian Starkey 
> > > Cc: Chen Feng 
> > > Cc: Chen-Yu Tsai 
> > > Cc: Christian Gmeiner 
> > > Cc: "Christian König" 
> > > Cc: Chun-Kuang Hu 
> > > Cc: Edmund Dea 
> > > Cc: Eric Anholt 
> > > Cc: Fabio Estevam 
> > > Cc: Gerd Hoffmann 
> > > Cc: Haneen Mohammed 
> > > Cc: Hans de Goede 
> > > Cc: "Heiko Stübner" 
> > > Cc: Huang Rui 
> > > Cc: Hyun Kwon 
> > > Cc: Inki Dae 
> > > Cc: Jani Nikula 
> > > Cc: Jernej Skrabec 
> > > Cc: Jerome Brunet 
> > > Cc: Joel Stanley 
> > > Cc: John Stultz 
> > > Cc: Jonas Karlman 
> > > Cc: Jonathan Hunter 
> > > Cc: Joonas Lahtinen 
> > > Cc: Joonyoung Shim 
> > > Cc: Jyri Sarha 
> > > Cc: Kevin Hilman 
> > > Cc: Kieran Bingham 
> > > Cc: Krzysztof Kozlowski 
> > > Cc: Kyungmin Park 
> > > Cc: Laurent Pinchart 
> > > Cc: Linus Walleij 
> > > Cc: Liviu Dudau 
> > > Cc: Lucas Stach 
> > > Cc: Ludovic Desroches 
> > > Cc: Marek Vasut 
> > > Cc: Martin Blumenstingl 
> > > Cc: Matthias Brugger 
> > > Cc: Maxime Coquelin 
> > > Cc: Maxime Ripard 
> > > Cc: Melissa Wen 
> > > Cc: Neil Armstrong 
> > > Cc: Nicolas Ferre 
> > > Cc: "Noralf Trønnes" 
> > > Cc: NXP Linux Team 
> > > Cc: Oleksandr Andrushchenko 
> > > Cc: Patrik Jakobsson 
> > > Cc: Paul Cercueil 
> > > Cc: Pekka Paalanen 
> > > Cc: Pengutronix Kernel Team 
> > > Cc: Philippe Cornu 
> > > Cc: Philipp Zabel 
> > > Cc: Qiang Yu 
> > > Cc: Rob Clark 
> > > Cc: Robert Foss 
> > > Cc: Rob Herring 
> > > Cc: Rodrigo Siqueira 
> > > Cc: Rodrigo Vivi 
> > > Cc: Roland Scheidegger 
> > > Cc: Russell King 
> > > Cc: Sam Ravnborg 
> > > Cc: Sandy Huang 
> > > Cc: Sascha Hauer 
> > > Cc: Sean Paul 
> > > Cc: Seung-Woo Kim 
> > > Cc: Shawn Guo 
> > > Cc: Simon Ser 
> > > Cc: Stefan Agner 
> > > Cc: Steven Price 
> > > Cc: Sumit Semwal 
> > > Cc: Thierry Reding 
> > > Cc: Tian Tao 
> > > Cc: Tomeu Vizoso 
> > > Cc: Tomi Valkeinen 
> > > Cc: VMware Graphics 
> > > Cc: Xinliang Liu 
> > > Cc: Xinwei Kong 
> > > Cc: Yannick Fertre 
> > > Cc: Zack Rusin 
> > > Reviewed-by: Daniel Vetter 
> > > Signed-off-by: Maxime Ripard 
> > > 
> > > ---
> > > 
> > > Changes from v3:
> > >   - Roll back to the v2
> > >   - Add Simon and Pekka in Cc
> > > 
> > > Changes from v2:
> > >   - Take into account the feedback from Laurent and Lidiu to no longer
> > > force generic properties, but prefix vendor-specific properties with
> > > the vendor name
> > > 
> > > Changes from v1:
> > >   - Typos and wording reported by Daniel and Alex
> > > ---
> > >  Documentation/gpu/drm-kms.rst | 19 +++
> > >  1 file changed, 19 insertions(+)
> > > 
> > > diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
> > > index 87e5023e3f55..c28b464dd397 100644
> > > --- a/Documentation/gpu/drm-kms.rst
> > > +++ b/Documentation/gpu/drm-kms.rst
> > > @@ -463,6 +463,25 @@ KMS Properties
> > >  This section of the documentation is primarily aimed at user-space 
> > > developers.
> > >  For the driver APIs, see the other sections.
> > >  
> > > +Requirements
> > > +
> > > +
> > > +KMS drivers might need to add extra properties to support new features.
> > > +Each new property introduced in a driver need to meet a few
> > > +requirements, in addition to the one mentioned above.:
> > > +
> > > +- It must be standardized, with some documentation to describe how the
> > > +  property can be used.  
> > 
> > Hi,
> > 
> > I might replace "some" with "full" documentation. Also not only how it
> > can be used but also what it does.
> > 
> > FYI, some common things that tend to be forgotten IME:
> > - Spell out exactly the name string for the property in the
> >   documentation so that it is unambiguous what string userspace should
> >   look for.
> > - The same for string names of enum values.
> > - Explicitly document what each enum value means, do not trust that the
> >   value name describes it well enough.
> > - Explain how the property interacts with other, existing properties.
> > 
> > Not sure if these should be written down here or anywhere though.
> > Interaction with other properties is kind of important.
> >   
> > > +
> > > +- It must provide a generic helper in the core code to register that
> > > +  pr

Re: [PATCH v4] Documentation: gpu: Mention the requirements for new properties

2021-07-06 Thread Maxime Ripard
Hi Pekka,

On Thu, Jun 17, 2021 at 11:20:36AM +0300, Pekka Paalanen wrote:
> On Wed, 16 Jun 2021 16:38:42 +0200
> Maxime Ripard  wrote:
> 
> > New KMS properties come with a bunch of requirements to avoid each
> > driver from running their own, inconsistent, set of properties,
> > eventually leading to issues like property conflicts, inconsistencies
> > between drivers and semantics, etc.
> > 
> > Let's document what we expect.
> > 
> > Cc: Alexandre Belloni 
> > Cc: Alexandre Torgue 
> > Cc: Alex Deucher 
> > Cc: Alison Wang 
> > Cc: Alyssa Rosenzweig 
> > Cc: Andrew Jeffery 
> > Cc: Andrzej Hajda 
> > Cc: Anitha Chrisanthus 
> > Cc: Benjamin Gaignard 
> > Cc: Ben Skeggs 
> > Cc: Boris Brezillon 
> > Cc: Brian Starkey 
> > Cc: Chen Feng 
> > Cc: Chen-Yu Tsai 
> > Cc: Christian Gmeiner 
> > Cc: "Christian König" 
> > Cc: Chun-Kuang Hu 
> > Cc: Edmund Dea 
> > Cc: Eric Anholt 
> > Cc: Fabio Estevam 
> > Cc: Gerd Hoffmann 
> > Cc: Haneen Mohammed 
> > Cc: Hans de Goede 
> > Cc: "Heiko Stübner" 
> > Cc: Huang Rui 
> > Cc: Hyun Kwon 
> > Cc: Inki Dae 
> > Cc: Jani Nikula 
> > Cc: Jernej Skrabec 
> > Cc: Jerome Brunet 
> > Cc: Joel Stanley 
> > Cc: John Stultz 
> > Cc: Jonas Karlman 
> > Cc: Jonathan Hunter 
> > Cc: Joonas Lahtinen 
> > Cc: Joonyoung Shim 
> > Cc: Jyri Sarha 
> > Cc: Kevin Hilman 
> > Cc: Kieran Bingham 
> > Cc: Krzysztof Kozlowski 
> > Cc: Kyungmin Park 
> > Cc: Laurent Pinchart 
> > Cc: Linus Walleij 
> > Cc: Liviu Dudau 
> > Cc: Lucas Stach 
> > Cc: Ludovic Desroches 
> > Cc: Marek Vasut 
> > Cc: Martin Blumenstingl 
> > Cc: Matthias Brugger 
> > Cc: Maxime Coquelin 
> > Cc: Maxime Ripard 
> > Cc: Melissa Wen 
> > Cc: Neil Armstrong 
> > Cc: Nicolas Ferre 
> > Cc: "Noralf Trønnes" 
> > Cc: NXP Linux Team 
> > Cc: Oleksandr Andrushchenko 
> > Cc: Patrik Jakobsson 
> > Cc: Paul Cercueil 
> > Cc: Pekka Paalanen 
> > Cc: Pengutronix Kernel Team 
> > Cc: Philippe Cornu 
> > Cc: Philipp Zabel 
> > Cc: Qiang Yu 
> > Cc: Rob Clark 
> > Cc: Robert Foss 
> > Cc: Rob Herring 
> > Cc: Rodrigo Siqueira 
> > Cc: Rodrigo Vivi 
> > Cc: Roland Scheidegger 
> > Cc: Russell King 
> > Cc: Sam Ravnborg 
> > Cc: Sandy Huang 
> > Cc: Sascha Hauer 
> > Cc: Sean Paul 
> > Cc: Seung-Woo Kim 
> > Cc: Shawn Guo 
> > Cc: Simon Ser 
> > Cc: Stefan Agner 
> > Cc: Steven Price 
> > Cc: Sumit Semwal 
> > Cc: Thierry Reding 
> > Cc: Tian Tao 
> > Cc: Tomeu Vizoso 
> > Cc: Tomi Valkeinen 
> > Cc: VMware Graphics 
> > Cc: Xinliang Liu 
> > Cc: Xinwei Kong 
> > Cc: Yannick Fertre 
> > Cc: Zack Rusin 
> > Reviewed-by: Daniel Vetter 
> > Signed-off-by: Maxime Ripard 
> > 
> > ---
> > 
> > Changes from v3:
> >   - Roll back to the v2
> >   - Add Simon and Pekka in Cc
> > 
> > Changes from v2:
> >   - Take into account the feedback from Laurent and Lidiu to no longer
> > force generic properties, but prefix vendor-specific properties with
> > the vendor name
> > 
> > Changes from v1:
> >   - Typos and wording reported by Daniel and Alex
> > ---
> >  Documentation/gpu/drm-kms.rst | 19 +++
> >  1 file changed, 19 insertions(+)
> > 
> > diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
> > index 87e5023e3f55..c28b464dd397 100644
> > --- a/Documentation/gpu/drm-kms.rst
> > +++ b/Documentation/gpu/drm-kms.rst
> > @@ -463,6 +463,25 @@ KMS Properties
> >  This section of the documentation is primarily aimed at user-space 
> > developers.
> >  For the driver APIs, see the other sections.
> >  
> > +Requirements
> > +
> > +
> > +KMS drivers might need to add extra properties to support new features.
> > +Each new property introduced in a driver need to meet a few
> > +requirements, in addition to the one mentioned above.:
> > +
> > +- It must be standardized, with some documentation to describe how the
> > +  property can be used.
> 
> Hi,
> 
> I might replace "some" with "full" documentation. Also not only how it
> can be used but also what it does.
> 
> FYI, some common things that tend to be forgotten IME:
> - Spell out exactly the name string for the property in the
>   documentation so that it is unambiguous what string userspace should
>   look for.
> - The same for string names of enum values.
> - Explicitly document what each enum value means, do not trust that the
>   value name describes it well enough.
> - Explain how the property interacts with other, existing properties.
> 
> Not sure if these should be written down here or anywhere though.
> Interaction with other properties is kind of important.
> 
> > +
> > +- It must provide a generic helper in the core code to register that
> > +  property on the object it attaches to.
> > +
> > +- Its content must be decoded by the core and provided in the object's
> > +  associated state structure. That includes anything drivers might want to
> > +  precompute, like :c:type:`struct drm_clip_rect ` for 
> > planes.
> > +
> > +- An IGT test must be submitted where reasonable.
> 
> Would it be too much to replace "where reasonable

Re: [PATCH v4] Documentation: gpu: Mention the requirements for new properties

2021-06-17 Thread Daniel Vetter
On Thu, Jun 17, 2021 at 05:38:36PM +0200, Philippe CORNU wrote:
> 
> 
> On 6/16/21 4:38 PM, Maxime Ripard wrote:
> > New KMS properties come with a bunch of requirements to avoid each
> > driver from running their own, inconsistent, set of properties,
> > eventually leading to issues like property conflicts, inconsistencies
> > between drivers and semantics, etc.
> > 
> > Let's document what we expect.
> > 
> > Cc: Alexandre Belloni 
> > Cc: Alexandre Torgue 
> > Cc: Alex Deucher 
> > Cc: Alison Wang 
> > Cc: Alyssa Rosenzweig 
> > Cc: Andrew Jeffery 
> > Cc: Andrzej Hajda 
> > Cc: Anitha Chrisanthus 
> > Cc: Benjamin Gaignard 
> > Cc: Ben Skeggs 
> > Cc: Boris Brezillon 
> > Cc: Brian Starkey 
> > Cc: Chen Feng 
> > Cc: Chen-Yu Tsai 
> > Cc: Christian Gmeiner 
> > Cc: "Christian König" 
> > Cc: Chun-Kuang Hu 
> > Cc: Edmund Dea 
> > Cc: Eric Anholt 
> > Cc: Fabio Estevam 
> > Cc: Gerd Hoffmann 
> > Cc: Haneen Mohammed 
> > Cc: Hans de Goede 
> > Cc: "Heiko Stübner" 
> > Cc: Huang Rui 
> > Cc: Hyun Kwon 
> > Cc: Inki Dae 
> > Cc: Jani Nikula 
> > Cc: Jernej Skrabec 
> > Cc: Jerome Brunet 
> > Cc: Joel Stanley 
> > Cc: John Stultz 
> > Cc: Jonas Karlman 
> > Cc: Jonathan Hunter 
> > Cc: Joonas Lahtinen 
> > Cc: Joonyoung Shim 
> > Cc: Jyri Sarha 
> > Cc: Kevin Hilman 
> > Cc: Kieran Bingham 
> > Cc: Krzysztof Kozlowski 
> > Cc: Kyungmin Park 
> > Cc: Laurent Pinchart 
> > Cc: Linus Walleij 
> > Cc: Liviu Dudau 
> > Cc: Lucas Stach 
> > Cc: Ludovic Desroches 
> > Cc: Marek Vasut 
> > Cc: Martin Blumenstingl 
> > Cc: Matthias Brugger 
> > Cc: Maxime Coquelin 
> > Cc: Maxime Ripard 
> > Cc: Melissa Wen 
> > Cc: Neil Armstrong 
> > Cc: Nicolas Ferre 
> > Cc: "Noralf Trønnes" 
> > Cc: NXP Linux Team 
> > Cc: Oleksandr Andrushchenko 
> > Cc: Patrik Jakobsson 
> > Cc: Paul Cercueil 
> > Cc: Pekka Paalanen 
> > Cc: Pengutronix Kernel Team 
> > Cc: Philippe Cornu 
> > Cc: Philipp Zabel 
> > Cc: Qiang Yu 
> > Cc: Rob Clark 
> > Cc: Robert Foss 
> > Cc: Rob Herring 
> > Cc: Rodrigo Siqueira 
> > Cc: Rodrigo Vivi 
> > Cc: Roland Scheidegger 
> > Cc: Russell King 
> > Cc: Sam Ravnborg 
> > Cc: Sandy Huang 
> > Cc: Sascha Hauer 
> > Cc: Sean Paul 
> > Cc: Seung-Woo Kim 
> > Cc: Shawn Guo 
> > Cc: Simon Ser 
> > Cc: Stefan Agner 
> > Cc: Steven Price 
> > Cc: Sumit Semwal 
> > Cc: Thierry Reding 
> > Cc: Tian Tao 
> > Cc: Tomeu Vizoso 
> > Cc: Tomi Valkeinen 
> > Cc: VMware Graphics 
> > Cc: Xinliang Liu 
> > Cc: Xinwei Kong 
> > Cc: Yannick Fertre 
> > Cc: Zack Rusin 
> > Reviewed-by: Daniel Vetter 
> > Signed-off-by: Maxime Ripard 
> > 
> > ---
> > 
> > Changes from v3:
> >- Roll back to the v2
> >- Add Simon and Pekka in Cc
> > 
> > Changes from v2:
> >- Take into account the feedback from Laurent and Lidiu to no longer
> >  force generic properties, but prefix vendor-specific properties with
> >  the vendor name
> > 
> > Changes from v1:
> >- Typos and wording reported by Daniel and Alex
> > ---
> >   Documentation/gpu/drm-kms.rst | 19 +++
> >   1 file changed, 19 insertions(+)
> > 
> > diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
> > index 87e5023e3f55..c28b464dd397 100644
> > --- a/Documentation/gpu/drm-kms.rst
> > +++ b/Documentation/gpu/drm-kms.rst
> > @@ -463,6 +463,25 @@ KMS Properties
> >   This section of the documentation is primarily aimed at user-space 
> > developers.
> >   For the driver APIs, see the other sections.
> > +Requirements
> > +
> > +
> > +KMS drivers might need to add extra properties to support new features.
> > +Each new property introduced in a driver need to meet a few
> > +requirements, in addition to the one mentioned above.:
> > +
> > +- It must be standardized, with some documentation to describe how the
> > +  property can be used.
> > +
> > +- It must provide a generic helper in the core code to register that
> > +  property on the object it attaches to.
> > +
> > +- Its content must be decoded by the core and provided in the object's
> > +  associated state structure. That includes anything drivers might want to
> > +  precompute, like :c:type:`struct drm_clip_rect ` for 
> > planes.
> > +
> > +- An IGT test must be submitted where reasonable.
> > +
> >   Property Types and Blob Property Support
> >   
> > 
> 
> Hi,
> 
> Regarding properties, we have a “case study example” related in a certain
> way to this documentation update :-)
> 
> The use case: on a front desk at an exhibition, there is a welcome screen
> you can touch for searching various information. When this welcome screen is
> in idle, a small logo is displayed at its center (around 20% of the
> fullscreen). The logo has a white background color. We want to reduce the
> ddr usage for lowering the power (the board is battery powered) so the idea
> is to use a white background color around this logo, produced by the drm
> CRTC so the image in ddr is only the size of the logo.
> 
> Reading the thread
> 

Re: [PATCH v4] Documentation: gpu: Mention the requirements for new properties

2021-06-17 Thread Philippe CORNU




On 6/16/21 4:38 PM, Maxime Ripard wrote:

New KMS properties come with a bunch of requirements to avoid each
driver from running their own, inconsistent, set of properties,
eventually leading to issues like property conflicts, inconsistencies
between drivers and semantics, etc.

Let's document what we expect.

Cc: Alexandre Belloni 
Cc: Alexandre Torgue 
Cc: Alex Deucher 
Cc: Alison Wang 
Cc: Alyssa Rosenzweig 
Cc: Andrew Jeffery 
Cc: Andrzej Hajda 
Cc: Anitha Chrisanthus 
Cc: Benjamin Gaignard 
Cc: Ben Skeggs 
Cc: Boris Brezillon 
Cc: Brian Starkey 
Cc: Chen Feng 
Cc: Chen-Yu Tsai 
Cc: Christian Gmeiner 
Cc: "Christian König" 
Cc: Chun-Kuang Hu 
Cc: Edmund Dea 
Cc: Eric Anholt 
Cc: Fabio Estevam 
Cc: Gerd Hoffmann 
Cc: Haneen Mohammed 
Cc: Hans de Goede 
Cc: "Heiko Stübner" 
Cc: Huang Rui 
Cc: Hyun Kwon 
Cc: Inki Dae 
Cc: Jani Nikula 
Cc: Jernej Skrabec 
Cc: Jerome Brunet 
Cc: Joel Stanley 
Cc: John Stultz 
Cc: Jonas Karlman 
Cc: Jonathan Hunter 
Cc: Joonas Lahtinen 
Cc: Joonyoung Shim 
Cc: Jyri Sarha 
Cc: Kevin Hilman 
Cc: Kieran Bingham 
Cc: Krzysztof Kozlowski 
Cc: Kyungmin Park 
Cc: Laurent Pinchart 
Cc: Linus Walleij 
Cc: Liviu Dudau 
Cc: Lucas Stach 
Cc: Ludovic Desroches 
Cc: Marek Vasut 
Cc: Martin Blumenstingl 
Cc: Matthias Brugger 
Cc: Maxime Coquelin 
Cc: Maxime Ripard 
Cc: Melissa Wen 
Cc: Neil Armstrong 
Cc: Nicolas Ferre 
Cc: "Noralf Trønnes" 
Cc: NXP Linux Team 
Cc: Oleksandr Andrushchenko 
Cc: Patrik Jakobsson 
Cc: Paul Cercueil 
Cc: Pekka Paalanen 
Cc: Pengutronix Kernel Team 
Cc: Philippe Cornu 
Cc: Philipp Zabel 
Cc: Qiang Yu 
Cc: Rob Clark 
Cc: Robert Foss 
Cc: Rob Herring 
Cc: Rodrigo Siqueira 
Cc: Rodrigo Vivi 
Cc: Roland Scheidegger 
Cc: Russell King 
Cc: Sam Ravnborg 
Cc: Sandy Huang 
Cc: Sascha Hauer 
Cc: Sean Paul 
Cc: Seung-Woo Kim 
Cc: Shawn Guo 
Cc: Simon Ser 
Cc: Stefan Agner 
Cc: Steven Price 
Cc: Sumit Semwal 
Cc: Thierry Reding 
Cc: Tian Tao 
Cc: Tomeu Vizoso 
Cc: Tomi Valkeinen 
Cc: VMware Graphics 
Cc: Xinliang Liu 
Cc: Xinwei Kong 
Cc: Yannick Fertre 
Cc: Zack Rusin 
Reviewed-by: Daniel Vetter 
Signed-off-by: Maxime Ripard 

---

Changes from v3:
   - Roll back to the v2
   - Add Simon and Pekka in Cc

Changes from v2:
   - Take into account the feedback from Laurent and Lidiu to no longer
 force generic properties, but prefix vendor-specific properties with
 the vendor name

Changes from v1:
   - Typos and wording reported by Daniel and Alex
---
  Documentation/gpu/drm-kms.rst | 19 +++
  1 file changed, 19 insertions(+)

diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
index 87e5023e3f55..c28b464dd397 100644
--- a/Documentation/gpu/drm-kms.rst
+++ b/Documentation/gpu/drm-kms.rst
@@ -463,6 +463,25 @@ KMS Properties
  This section of the documentation is primarily aimed at user-space developers.
  For the driver APIs, see the other sections.
  
+Requirements

+
+
+KMS drivers might need to add extra properties to support new features.
+Each new property introduced in a driver need to meet a few
+requirements, in addition to the one mentioned above.:
+
+- It must be standardized, with some documentation to describe how the
+  property can be used.
+
+- It must provide a generic helper in the core code to register that
+  property on the object it attaches to.
+
+- Its content must be decoded by the core and provided in the object's
+  associated state structure. That includes anything drivers might want to
+  precompute, like :c:type:`struct drm_clip_rect ` for planes.
+
+- An IGT test must be submitted where reasonable.
+
  Property Types and Blob Property Support
  
  



Hi,

Regarding properties, we have a “case study example” related in a 
certain way to this documentation update :-)


The use case: on a front desk at an exhibition, there is a welcome 
screen you can touch for searching various information. When this 
welcome screen is in idle, a small logo is displayed at its center 
(around 20% of the fullscreen). The logo has a white background color. 
We want to reduce the ddr usage for lowering the power (the board is 
battery powered) so the idea is to use a white background color around 
this logo, produced by the drm CRTC so the image in ddr is only the size 
of the logo.


Reading the thread 
https://lists.freedesktop.org/archives/dri-devel/2019-October/239733.html 
dissuade us from coding a generic solution, so we started to implement a 
"STM_" private background color property, it works... but we are not at 
all convince this is the right way and we clearly prefer 
mainline/generic sw for both kernel & userland.


So now, what are our options... well, this v4 documentation update is I 
think clear enough: we have to document + provide a generic helper in 
the core code (similar to the original patch) + update IGT test, right?


Thanks
Philippe :-)

Note: It is really a pleasure to read such interesting thread, exposing 
the “complexity” of our job, dea

Re: [PATCH v4] Documentation: gpu: Mention the requirements for new properties

2021-06-17 Thread Pekka Paalanen
On Wed, 16 Jun 2021 16:38:42 +0200
Maxime Ripard  wrote:

> New KMS properties come with a bunch of requirements to avoid each
> driver from running their own, inconsistent, set of properties,
> eventually leading to issues like property conflicts, inconsistencies
> between drivers and semantics, etc.
> 
> Let's document what we expect.
> 
> Cc: Alexandre Belloni 
> Cc: Alexandre Torgue 
> Cc: Alex Deucher 
> Cc: Alison Wang 
> Cc: Alyssa Rosenzweig 
> Cc: Andrew Jeffery 
> Cc: Andrzej Hajda 
> Cc: Anitha Chrisanthus 
> Cc: Benjamin Gaignard 
> Cc: Ben Skeggs 
> Cc: Boris Brezillon 
> Cc: Brian Starkey 
> Cc: Chen Feng 
> Cc: Chen-Yu Tsai 
> Cc: Christian Gmeiner 
> Cc: "Christian König" 
> Cc: Chun-Kuang Hu 
> Cc: Edmund Dea 
> Cc: Eric Anholt 
> Cc: Fabio Estevam 
> Cc: Gerd Hoffmann 
> Cc: Haneen Mohammed 
> Cc: Hans de Goede 
> Cc: "Heiko Stübner" 
> Cc: Huang Rui 
> Cc: Hyun Kwon 
> Cc: Inki Dae 
> Cc: Jani Nikula 
> Cc: Jernej Skrabec 
> Cc: Jerome Brunet 
> Cc: Joel Stanley 
> Cc: John Stultz 
> Cc: Jonas Karlman 
> Cc: Jonathan Hunter 
> Cc: Joonas Lahtinen 
> Cc: Joonyoung Shim 
> Cc: Jyri Sarha 
> Cc: Kevin Hilman 
> Cc: Kieran Bingham 
> Cc: Krzysztof Kozlowski 
> Cc: Kyungmin Park 
> Cc: Laurent Pinchart 
> Cc: Linus Walleij 
> Cc: Liviu Dudau 
> Cc: Lucas Stach 
> Cc: Ludovic Desroches 
> Cc: Marek Vasut 
> Cc: Martin Blumenstingl 
> Cc: Matthias Brugger 
> Cc: Maxime Coquelin 
> Cc: Maxime Ripard 
> Cc: Melissa Wen 
> Cc: Neil Armstrong 
> Cc: Nicolas Ferre 
> Cc: "Noralf Trønnes" 
> Cc: NXP Linux Team 
> Cc: Oleksandr Andrushchenko 
> Cc: Patrik Jakobsson 
> Cc: Paul Cercueil 
> Cc: Pekka Paalanen 
> Cc: Pengutronix Kernel Team 
> Cc: Philippe Cornu 
> Cc: Philipp Zabel 
> Cc: Qiang Yu 
> Cc: Rob Clark 
> Cc: Robert Foss 
> Cc: Rob Herring 
> Cc: Rodrigo Siqueira 
> Cc: Rodrigo Vivi 
> Cc: Roland Scheidegger 
> Cc: Russell King 
> Cc: Sam Ravnborg 
> Cc: Sandy Huang 
> Cc: Sascha Hauer 
> Cc: Sean Paul 
> Cc: Seung-Woo Kim 
> Cc: Shawn Guo 
> Cc: Simon Ser 
> Cc: Stefan Agner 
> Cc: Steven Price 
> Cc: Sumit Semwal 
> Cc: Thierry Reding 
> Cc: Tian Tao 
> Cc: Tomeu Vizoso 
> Cc: Tomi Valkeinen 
> Cc: VMware Graphics 
> Cc: Xinliang Liu 
> Cc: Xinwei Kong 
> Cc: Yannick Fertre 
> Cc: Zack Rusin 
> Reviewed-by: Daniel Vetter 
> Signed-off-by: Maxime Ripard 
> 
> ---
> 
> Changes from v3:
>   - Roll back to the v2
>   - Add Simon and Pekka in Cc
> 
> Changes from v2:
>   - Take into account the feedback from Laurent and Lidiu to no longer
> force generic properties, but prefix vendor-specific properties with
> the vendor name
> 
> Changes from v1:
>   - Typos and wording reported by Daniel and Alex
> ---
>  Documentation/gpu/drm-kms.rst | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
> index 87e5023e3f55..c28b464dd397 100644
> --- a/Documentation/gpu/drm-kms.rst
> +++ b/Documentation/gpu/drm-kms.rst
> @@ -463,6 +463,25 @@ KMS Properties
>  This section of the documentation is primarily aimed at user-space 
> developers.
>  For the driver APIs, see the other sections.
>  
> +Requirements
> +
> +
> +KMS drivers might need to add extra properties to support new features.
> +Each new property introduced in a driver need to meet a few
> +requirements, in addition to the one mentioned above.:
> +
> +- It must be standardized, with some documentation to describe how the
> +  property can be used.

Hi,

I might replace "some" with "full" documentation. Also not only how it
can be used but also what it does.

FYI, some common things that tend to be forgotten IME:
- Spell out exactly the name string for the property in the
  documentation so that it is unambiguous what string userspace should
  look for.
- The same for string names of enum values.
- Explicitly document what each enum value means, do not trust that the
  value name describes it well enough.
- Explain how the property interacts with other, existing properties.

Not sure if these should be written down here or anywhere though.
Interaction with other properties is kind of important.

> +
> +- It must provide a generic helper in the core code to register that
> +  property on the object it attaches to.
> +
> +- Its content must be decoded by the core and provided in the object's
> +  associated state structure. That includes anything drivers might want to
> +  precompute, like :c:type:`struct drm_clip_rect ` for planes.
> +
> +- An IGT test must be submitted where reasonable.

Would it be too much to replace "where reasonable" with "if it is at
all possible to write a test."?

> +

How about adding the following somewhere?

- The initial state of the property (set during driver initialization)
  must match how the driver+hardware behaved before introducing this
  property. It may be some fixed value or it may be inherited from e.g.
  the firmware that booted the system. How the initial state is
  determined must also be documented,

[PATCH v4] Documentation: gpu: Mention the requirements for new properties

2021-06-16 Thread Maxime Ripard
New KMS properties come with a bunch of requirements to avoid each
driver from running their own, inconsistent, set of properties,
eventually leading to issues like property conflicts, inconsistencies
between drivers and semantics, etc.

Let's document what we expect.

Cc: Alexandre Belloni 
Cc: Alexandre Torgue 
Cc: Alex Deucher 
Cc: Alison Wang 
Cc: Alyssa Rosenzweig 
Cc: Andrew Jeffery 
Cc: Andrzej Hajda 
Cc: Anitha Chrisanthus 
Cc: Benjamin Gaignard 
Cc: Ben Skeggs 
Cc: Boris Brezillon 
Cc: Brian Starkey 
Cc: Chen Feng 
Cc: Chen-Yu Tsai 
Cc: Christian Gmeiner 
Cc: "Christian König" 
Cc: Chun-Kuang Hu 
Cc: Edmund Dea 
Cc: Eric Anholt 
Cc: Fabio Estevam 
Cc: Gerd Hoffmann 
Cc: Haneen Mohammed 
Cc: Hans de Goede 
Cc: "Heiko Stübner" 
Cc: Huang Rui 
Cc: Hyun Kwon 
Cc: Inki Dae 
Cc: Jani Nikula 
Cc: Jernej Skrabec 
Cc: Jerome Brunet 
Cc: Joel Stanley 
Cc: John Stultz 
Cc: Jonas Karlman 
Cc: Jonathan Hunter 
Cc: Joonas Lahtinen 
Cc: Joonyoung Shim 
Cc: Jyri Sarha 
Cc: Kevin Hilman 
Cc: Kieran Bingham 
Cc: Krzysztof Kozlowski 
Cc: Kyungmin Park 
Cc: Laurent Pinchart 
Cc: Linus Walleij 
Cc: Liviu Dudau 
Cc: Lucas Stach 
Cc: Ludovic Desroches 
Cc: Marek Vasut 
Cc: Martin Blumenstingl 
Cc: Matthias Brugger 
Cc: Maxime Coquelin 
Cc: Maxime Ripard 
Cc: Melissa Wen 
Cc: Neil Armstrong 
Cc: Nicolas Ferre 
Cc: "Noralf Trønnes" 
Cc: NXP Linux Team 
Cc: Oleksandr Andrushchenko 
Cc: Patrik Jakobsson 
Cc: Paul Cercueil 
Cc: Pekka Paalanen 
Cc: Pengutronix Kernel Team 
Cc: Philippe Cornu 
Cc: Philipp Zabel 
Cc: Qiang Yu 
Cc: Rob Clark 
Cc: Robert Foss 
Cc: Rob Herring 
Cc: Rodrigo Siqueira 
Cc: Rodrigo Vivi 
Cc: Roland Scheidegger 
Cc: Russell King 
Cc: Sam Ravnborg 
Cc: Sandy Huang 
Cc: Sascha Hauer 
Cc: Sean Paul 
Cc: Seung-Woo Kim 
Cc: Shawn Guo 
Cc: Simon Ser 
Cc: Stefan Agner 
Cc: Steven Price 
Cc: Sumit Semwal 
Cc: Thierry Reding 
Cc: Tian Tao 
Cc: Tomeu Vizoso 
Cc: Tomi Valkeinen 
Cc: VMware Graphics 
Cc: Xinliang Liu 
Cc: Xinwei Kong 
Cc: Yannick Fertre 
Cc: Zack Rusin 
Reviewed-by: Daniel Vetter 
Signed-off-by: Maxime Ripard 

---

Changes from v3:
  - Roll back to the v2
  - Add Simon and Pekka in Cc

Changes from v2:
  - Take into account the feedback from Laurent and Lidiu to no longer
force generic properties, but prefix vendor-specific properties with
the vendor name

Changes from v1:
  - Typos and wording reported by Daniel and Alex
---
 Documentation/gpu/drm-kms.rst | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
index 87e5023e3f55..c28b464dd397 100644
--- a/Documentation/gpu/drm-kms.rst
+++ b/Documentation/gpu/drm-kms.rst
@@ -463,6 +463,25 @@ KMS Properties
 This section of the documentation is primarily aimed at user-space developers.
 For the driver APIs, see the other sections.
 
+Requirements
+
+
+KMS drivers might need to add extra properties to support new features.
+Each new property introduced in a driver need to meet a few
+requirements, in addition to the one mentioned above.:
+
+- It must be standardized, with some documentation to describe how the
+  property can be used.
+
+- It must provide a generic helper in the core code to register that
+  property on the object it attaches to.
+
+- Its content must be decoded by the core and provided in the object's
+  associated state structure. That includes anything drivers might want to
+  precompute, like :c:type:`struct drm_clip_rect ` for planes.
+
+- An IGT test must be submitted where reasonable.
+
 Property Types and Blob Property Support
 
 
-- 
2.31.1