drm: Add library for shmem backed GEM objects
authorNoralf Trønnes <noralf@tronnes.org>
Wed, 13 Mar 2019 00:43:44 +0000 (19:43 -0500)
committerEric Anholt <eric@anholt.net>
Thu, 14 Mar 2019 19:06:44 +0000 (12:06 -0700)
commit2194a63a818db71065ebe09c8104f5f021ca4e7b
treee3ead32c4e363abc6572b8a2db1646b051cd9fd0
parent2de3a078497b4fd7f77964602445521f7a534cfb
drm: Add library for shmem backed GEM objects

This adds a library for shmem backed GEM objects.

v8:
- export drm_gem_shmem_create_with_handle
- call mapping_set_gfp_mask to set default zone to GFP_HIGHUSER
- Add helper drm_gem_shmem_get_pages_sgt()

v7:
- Use write-combine for mmap instead. This is the more common
  case. (robher)

v6:
- Fix uninitialized variable issue in an error path (anholt).
- Add a drm_gem_shmem_vm_open() to the fops to get proper refcounting
  of the pages (anholt).

v5:
- Drop drm_gem_shmem_prime_mmap() (Daniel Vetter)
- drm_gem_shmem_mmap(): Subtract drm_vma_node_start() to get the real
  vma->vm_pgoff
- drm_gem_shmem_fault(): Use vmf->pgoff now that vma->vm_pgoff is correct

v4:
- Drop cache modes (Thomas Hellstrom)
- Add a GEM attached vtable

v3:
- Grammar (Sam Ravnborg)
- s/drm_gem_shmem_put_pages_unlocked/drm_gem_shmem_put_pages_locked/
  (Sam Ravnborg)
- Add debug output in error path (Sam Ravnborg)

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190313004344.24169-1-robh@kernel.org
Documentation/gpu/drm-kms-helpers.rst
drivers/gpu/drm/Kconfig
drivers/gpu/drm/Makefile
drivers/gpu/drm/drm_gem_shmem_helper.c [new file with mode: 0644]
include/drm/drm_gem_shmem_helper.h [new file with mode: 0644]