[Intel-gfx] [PATCH] drm/i915: Clarify the safety of the early unpin of old_fb->obj
Daniel Vetter
daniel at ffwll.ch
Tue May 20 10:22:10 CEST 2014
On Tue, May 20, 2014 at 10:16:54AM +0200, Daniel Vetter wrote:
> On Tue, May 20, 2014 at 08:47:41AM +0100, Chris Wilson wrote:
> > Daniel simplified the modesetting code to push the common work performed
> > by each of the architecture specific routines higher into the caller. This
> > took me a while to be sure that it was safe in the event of a
> > modesetting failure - to be sure that the dangling pointer we left in
> > the registers would never be accessed. As it turns out, it is safe, as
> > even after the most convoluted error path, we always rewrite the address
> > registers with the currently pinned object before enabling the planes
> > and pipes. This patch just adds an assertion that the preconditions
> > Daniel stated are correct, and a comment to justify the dance.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
>
> Hm, I think we should tackle the larger issue here and have a bit of a
> plane config checker, to make sure reality matches up with what we expect
> it to be. But I'm not sure that effort is worth it.
>
> Wrt the assert I actually prefer we keep those in the low-level callbacks.
> At least they often encode platform specifics, which will be more obvious
> once we have atomic modesets support and also need to deal with sprites
> and cursors here.
Long-term I want to share more of this prep code with the pageflip code
anyway, i.e. the overall code structure of the full-blown magic modeset
would be:
1. Compute config and figure out what needs to be done. Bail out if it's
not possible.
2. Pin buffers for everything (so including cursors and stuff).
3. Nuclear pageflip to solid black on all pipes we want to disable
(currently embedded in the crtc_disable hooks still)
4. Shut down pipes.
5. Commit sw state from staging areas to actual state pointers.
6. Fire up all the pipes again.
7. Nuclear pageflip from solid black to the desired output configuration.
If step 1 notices that nothing needs to be done for steps 4-6 then we'll
fuse steps 3&7 together and just do one nuclear pageflip. There's also
going to be a fun complication due to DP retraining.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list