drm/nouveau: Move PBN and VCPI allocation into nv50_head_atom
authorLyude Paul <lyude@redhat.com>
Sat, 2 Feb 2019 00:20:04 +0000 (19:20 -0500)
committerLyude Paul <lyude@redhat.com>
Tue, 5 Feb 2019 23:19:44 +0000 (18:19 -0500)
commit88ec89adec3630a67d682c032c946e1bd4f59ac2
tree70b74b594f5856f2fd4e3652d076afef5c098a8d
parent022debad063e4d3fb456218273821c010757f6f7
drm/nouveau: Move PBN and VCPI allocation into nv50_head_atom

Atomic checks should never modify anything outside of the state that
they're passed in. Unfortunately this appears to be exactly what we're
doing in nv50_msto_atomic_check() where we update mstc->pbn every time
the function is called. This hasn't caused any bugs yet, but it needs to
be fixed in order to ensure that when committing an artificially
duplicated state (like during system resume), that we reuse the PBN of
that state to perform VCPI allocations and don't recalculate a different
value from the drm connector's reported bpc.

Also, move the VCPI slot allocations while we're at it as well. With
this, removing a topology in suspend while using nouveau no longer
causes the new atomic VCPI helpers to complain.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: eceae1472467 ("drm/dp_mst: Start tracking per-port VCPI allocations")
Cc: Daniel Vetter <daniel@ffwll.ch>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190202002023.29665-5-lyude@redhat.com
drivers/gpu/drm/nouveau/dispnv50/atom.h
drivers/gpu/drm/nouveau/dispnv50/disp.c
drivers/gpu/drm/nouveau/dispnv50/head.c