[PATCH 0/8] drm/vram-helper: Lock GEM BOs while they are mapped

Thomas Zimmermann tzimmermann at suse.de
Mon Nov 30 12:45:28 UTC 2020


Hi

Am 30.11.20 um 13:04 schrieb Thomas Zimmermann:
> GEM VRAM helpers used to pin the BO in their implementation of vmap, so
> that they could not be relocated. In a recent discussion, [1] it became

[1] was supposed to point to the discussion at

   https://patchwork.freedesktop.org/patch/400054/?series=83765&rev=1



> clear that this is incorrect and that vmap should rather repend on the
> reservation lock to prevent relocation. This patchset addresses the issue.
> Besides the vram helpers, this affects ast, vboxvideo and the generic
> fbdev emulation.
> 
> Patch 1 adds a few more rules to vmap internfaces. With VRAM, it is
> necessary to keep the BO evictable, which requires soem care when mapping
> the memory. Patch 2 changes ast's cursor code accordingly.
> 
> Patch 3 adds vram helpers that acquires the reservation lock and vmap the
> memory buffer. Same for vunmap in reverse. Patches 4 and 5 convert ast
> and vboxvideo to the new helper.
> 
> Patch 6 removes pinning and locking from VRAM helper's vmap and vunmap.
> The affected users in ast and fbdev emulation acquire the reservation
> locks of the GEM objects before vmapping BOs. VRAM helpers don't support
> to export the buffer, so there are no other users of these functions.
> 
> The the pinning and locking removed, vmap can be simplified as done in
> patches 7 and 8.
> 
> Tested on ast with GEM VRAM and also on mgag200 to verify that the fbdev
> change does not interfere with GEM SHMEM.
> 
> Thomas Zimmermann (8):
>    drm/gem: Write down some rules for vmap usage
>    drm/ast: Only map cursor BOs during updates
>    drm/vram-helper: Provide drm_gem_vram_vmap_unlocked()
>    drm/ast: Use drm_gem_vram_vmap_unlocked() in ast_cursor_show()
>    drm/vboxvideo: Use drm_gem_vram_vmap_unlocked() in cursor update
>    drm/vram-helper: Remove pinning and locking from drm_gem_vram_vmap()
>    drm/vram-helper: Remove vmap reference counting
>    drm/vram-helper: Simplify vmap implementation
> 
>   drivers/gpu/drm/ast/ast_cursor.c      |  63 +++++++++-------
>   drivers/gpu/drm/ast/ast_drv.h         |   2 -
>   drivers/gpu/drm/drm_client.c          |  31 ++++++++
>   drivers/gpu/drm/drm_fb_helper.c       |  10 ++-
>   drivers/gpu/drm/drm_gem_vram_helper.c | 101 +++++++++++++-------------
>   drivers/gpu/drm/drm_prime.c           |   6 ++
>   drivers/gpu/drm/vboxvideo/vbox_mode.c |   7 +-
>   include/drm/drm_client.h              |   2 +
>   include/drm/drm_gem.h                 |  16 ++++
>   include/drm/drm_gem_vram_helper.h     |  21 ++----
>   10 files changed, 159 insertions(+), 100 deletions(-)
> 
> --
> 2.29.2
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20201130/5cac850c/attachment.sig>


More information about the dri-devel mailing list