Operating KMS UAPI (Re: RFC: Drm-connector properties managed by another driver / privacy screen support)

Pekka Paalanen ppaalanen at gmail.com
Thu May 7 09:03:13 UTC 2020

On Tue, 5 May 2020 10:48:52 +0200
Daniel Vetter <daniel at ffwll.ch> wrote:

> Refocusing on where I think we still have a bit a disconnnect.
> On Mon, May 04, 2020 at 03:22:28PM +0300, Pekka Paalanen wrote:
> > On Mon, 4 May 2020 13:00:02 +0200
> > Daniel Vetter <daniel at ffwll.ch> wrote:  
> > > On Mon, May 4, 2020 at 11:49 AM Pekka Paalanen <ppaalanen at gmail.com> wrote:  
> > > > On Thu, 30 Apr 2020 15:53:23 +0200
> > > > Daniel Vetter <daniel at ffwll.ch> wrote:  
> > > I guess my point is, this is a lot bigger problem than just the
> > > default state. This = vt switching that doesn't look horrible and
> > > doesn't result in artifacts and issues on the new compositor.  
> > 
> > I am interested in getting reliably to the same hardware state as you
> > used to have before, either after reboots or after vt-switches. The
> > transition does not have to be guaranteed to be smooth, but at the same
> > time the restore policy should not exclude the possibility of a
> > smooth transition.  
> So my point is kinda that if you want both, then the only way to get there
> to have a very clear set of what's allowed to be left behind be the
> outgoing compositor. For example:
> - only primary plane
> - only untiled
> - no color transform magic
> - ...


agreed, and to this I was implicitly adding "for everything else the
old compositor must leave behind the so called default state".

That means the new compositor restoring defaults to the properties it
does not understand is a no-op, unless the old compositor violated the
smooth transition rules, in which case it might not be a smooth

If on some system, the default state does not result in a "usable"
picture on screen, then a compositor that does not understand the
property will always be broken and has always been broken.

If such compositor ever worked ok on such system, it was because it
inherited a property value that made things work. So if using defaults
breaks things, it means the defaults were not actually the defaults.

This definition probably means that defaults cannot be universal
constants, but I think it would be enough if they were constants given
the hardware and firmware at hand. IOW, not changed by simply rebooting
or upgrading the kernel.

> Imo this is a related problem to the save/restore topic, since if one
> compositor does something the new one doesn't understand (e.g. tiled
> buffers with modifiers, and new compositor doesn't use getfb2), then it's
> going to break.
> Similar, if the old compositor sets a new color transform property that
> the new compositor doesn't understand, then you get a mess.
> Blind restore handles the permanent mess issue, but it doesn't handle the
> smooth transition issue. But both problems are of the "old compositor did
> something the new compositor doesn't understand", hence why I chuck them
> into the same bin. And the issue with a blind save/restore, or kernel
> defaults, or any of the solutions proposed here is that they pretty much
> guarantee non-smooth transitions, they only solve the permanent damange
> part of the problem.

Right, except I disagree on the "guarantee non-smooth transition", as I
explained above.

> I think to solve both, we need some kind of proper compositor switching
> protocol, e.g. using logind:
> - old compositor transitions to the minimal config as specified somewhere
> - logind forces all other properties to "defaults", whether that's
>   restoring boot-up defaults or defaults obtained from the kernel or
>   something else is tbd

In my mind, the new compositor would do this step. If the old
compositor did its job, it's a no-op.

> - logind maybe even does a transition if there's multiple version of the
>   protocol, e.g. v2 allows modifiers, v1 only untiled, so it'd need to do
>   a blit to untiled if the new compositor only supports v1 switching
>   protocol

That would be fancy, but I'm not sure it's necessary. Maybe it becomes
useful one day, and then that day we can look into involving actual
protocol or logind. I just don't see a problem implementing the de
facto protocol v1 that already exists without logind or such.

> - new compositor takes over, and can continue the smooth transition since
>   it's a well-defined starting state with limited feature usage, _and_
>   everything else is reset to "defaults"
> I fear that if we only solve the "resets to defaults" issue then we can
> draw ourselves into a corner for the smooth transition stuff, if e.g. the
> wrong entity in the above dance forces the reset to defaults.

I guess we fundamentally agree. It just doesn't matter who does the
reset to defaults if the old compositor does not, the transition cannot
be smooth.

To me it seems the key here is that the old compositor *must* use "a
simple KMS setup" and reset everything else to defaults.

Actually, that's what we require in practise already. If the old
compositor leaves something funny in KMS state, the new compositor will
either glitch or be permanently broken when taking over.

The only thing that needs more work to fix is to prevent the permanent

I guess this line on thinking also shows the answer to what KMS programs
are supposed to do on switching out: clean up after yourself, but don't
shut CRTCs down or change video modes.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200507/98176712/attachment.sig>

More information about the dri-devel mailing list