[PATCH v3 3/3] drm/vram: Implement lazy unmapping for GEM VRAM buffers

Gerd Hoffmann kraxel at redhat.com
Fri Sep 6 11:18:43 UTC 2019


On Fri, Sep 06, 2019 at 12:37:47PM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 06.09.19 um 11:39 schrieb Gerd Hoffmann:
> >> +void drm_gem_vram_bo_driver_move_notify(struct ttm_buffer_object *bo,
> >> +					bool evict,
> >> +					struct ttm_mem_reg *new_mem)
> >> +{
> > [ ... ]
> >> +	if (!kmap->virtual)
> >> +		return;
> >> +	ttm_bo_kunmap(kmap);
> >> +	kmap->virtual = NULL;
> >> +}
> > 
> > I think ttm_buffer_object_destroy() needs "if (kmap->virtual)
> > ttm_bo_kunmap()" too, due to the lazy unmap you can land there
> > with an active mapping.
> 
> Hmm, from my understanding, that final call to move_notify() is done by
> ttm_bo_cleanup_memtype_use(), which is called from within ttm_bo_put().

Ah, good, sounds like this should work indeed.
Maybe add WARN_ON(kmap->virtual), just to be sure we don't overlooked something.

cheers,
  Gerd



More information about the dri-devel mailing list