drm/i915/gem: Break out some shmem backend utils
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Mon, 18 Oct 2021 09:10:48 +0000 (10:10 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Fri, 22 Oct 2021 12:19:18 +0000 (13:19 +0100)
commitf05b985e6f76eb9e57f36d0960a8beb46d5b46a8
tree45b66f2451a09e96f43293a8089dbfe331c67656
parentef3e619221248a7ea5fc711a2bf9017c94d2f644
drm/i915/gem: Break out some shmem backend utils

Break out some shmem backend utils for future reuse by the TTM backend:
shmem_alloc_st(), shmem_free_st() and __shmem_writeback() which we can
use to provide a shmem-backed TTM page pool for cached-only TTM
buffer objects.

Main functional change here is that we now compute the page sizes using
the dma segments rather than using the physical page address segments.

v2(Reported-by: kernel test robot <lkp@intel.com>)
    - Make sure we initialise the mapping on the error path in
      shmem_get_pages()

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018091055.1998191-1-matthew.auld@intel.com
drivers/gpu/drm/i915/gem/i915_gem_shmem.c