Re: [Intel-gfx] [PATCH] drm/atomic: Add the crtc to affected crtc only if uapi.enable = true

Daniel Stone
2021-03-16T23:47:03Z

[-- Attachment #1.1: Type: text/plain, Size: 1829 bytes --]

On Tue, 16 Mar 2021 at 21:35, Daniel Vetter <daniel@ffwll.ch> wrote:

> On Tue, Mar 9, 2021 at 10:14 AM Pekka Paalanen <ppaalanen@gmail.com>
> wrote:
> > On Mon, 8 Mar 2021 16:52:58 -0800
> > "Navare, Manasi" <manasi.d.navare@intel.com> wrote:
> > > Hmm well after the actual real commit, since the second crtc is stolen
> > > even though it is not being used for the display output, it is
> > > used for joiner so the uapi.enable will be true after the real commit.
> > >
> > > so actually the assertion would fail in this case.
> > >
> > > @Ville @Danvet any suggestions here in that case?
>
> That is very bad. We can't frob uapi state like that. I think that
> calls for even more checks to make sure kms drivers who try to play
> clever games don't get it wrong, so we probably need to check uapi
> enable and active state in another mask before/after ->atomic_check
> too. Or something like that.
>

Yeah. We can _never_ generate externally-visible completion events. We can
later fail to enable the stolen CRTC - because trying to enable new things
can fail for any reason whatsoever - but we can't generate spurious
completion events, as doing so falls into the uncanny valley.

If the kernel is doing clever things behind userspace's back - such as
stealing planes or CRTCs - then userspace can never know about it, apart
from failing to enable those resources later. The kernel can either never
do anything clever (and make userspace bind them both together), or be
extremely clever (by hiding the entire details from userspace), but it
cannot choose the halfway house of doing clever things behind userspace's
back (such as stealing new CRTCs) whilst also exposing all those details to
userspace (such as delivering spurious completion events for resources
userspace never requested to be programmed).

Cheers,
Daniel

[-- Attachment #1.2: Type: text/html, Size: 2441 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]