Re: [PATCH 7/8] drm/virtio: move virtio_gpu_object_{attach, detach} calls.
From: Gerd Hoffmann
Date: Thu Oct 18 2018 - 02:11:07 EST
On Thu, Oct 18, 2018 at 11:41:52AM +1000, Dave Airlie wrote:
> On Mon, 1 Oct 2018 at 20:33, Gerd Hoffmann <kraxel@xxxxxxxxxx> wrote:
> >
> > Remove the virtio_gpu_object_{attach,detach} calls from move_notify()
> > callback. Add them to the ttm_tt_{populate,unpopulate} callbacks, which
> > is the correct place to handle this.
> >
> > The new ttm_tt_{populate,unpopulate} callbacks call the
> > ttm_pool_populate()/unpopulate() functions (which are the default
> > implementation in case the callbacks not present) for the actual ttm
> > work. Additionally virtio_gpu_object_{attach,detach} is called to
> > update the state on the host.
>
> This to me feels more like a bind/unbind operation rather than a
> populate/unpopulate operation,
>
> bind is " Bind the backend pages into the aperture in the location"
>
> whereas populate is
>
> allocate pages for a ttm.
I ran into that trap too ;)
My first attempt was to map this to bind/unbind. But this is not
correct and therefore didn't work very well.
virtio_gpu_object_attach() will send a scatter list of the pages
allocated for the object to the host (so the host knows where to
copy from/to when processing the transfer_from/to calls). So IMO
it should be done on population not when binding.
cheers,
Gerd