drm/i915: Refactor ttm ghost obj detection
authorNirmoy Das <nirmoy.das@intel.com>
Fri, 14 Oct 2022 13:14:27 +0000 (15:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:06 +0000 (13:32 +0100)
commit37ec70c44ec9cc43d3b98c6f5f83eb018d2b02a4
tree583dbc49d3f8f709ba622f2837e9a0759520ac5a
parented52edf44432a053cda7a1891f6c97f746d92fad
drm/i915: Refactor ttm ghost obj detection

[ Upstream commit 6667d78a1123d237d66e34923754ebca97d06d39 ]

Currently i915_ttm_to_gem() returns NULL for ttm ghost
object which makes it unclear when we should add a NULL
check for a caller of i915_ttm_to_gem() as ttm ghost
objects are expected behaviour for certain cases.

Create a separate function to detect ttm ghost object and
use that in places where we expect a ghost obj from ttm.

Signed-off-by: Nirmoy Das <nirmoy.das@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/20221014131427.21102-1-nirmoy.das@intel.com
Stable-dep-of: 1cacd6894d5f ("drm/i915/dgfx: Grab wakeref at i915_ttm_unmap_virtual")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
drivers/gpu/drm/i915/gem/i915_gem_ttm.h
drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c