Skip to content

Commit

Permalink
drm/i915/stolen: shuffle around init_memory_region
Browse files Browse the repository at this point in the history
We generally want to first call i915_gem_object_init_memory_region()
before calling into get_pages(), since this sets up various bits of
state which might be needed there. Currently for stolen this doesn't
matter much, but it might in the future, and at the very least this
makes things consistent with the other backends.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210507095948.384230-1-matthew.auld@intel.com
  • Loading branch information
Matthew Auld committed May 11, 2021
1 parent e49a8b2 commit 00d6dc3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/gpu/drm/i915/gem/i915_gem_stolen.c
Original file line number Diff line number Diff line change
@@ -657,9 +657,11 @@ static int __i915_gem_object_create_stolen(struct intel_memory_region *mem,
if (WARN_ON(!i915_gem_object_trylock(obj)))
return -EBUSY;

i915_gem_object_init_memory_region(obj, mem);

err = i915_gem_object_pin_pages(obj);
if (!err)
i915_gem_object_init_memory_region(obj, mem);
if (err)
i915_gem_object_release_memory_region(obj);
i915_gem_object_unlock(obj);

return err;

0 comments on commit 00d6dc3

Please sign in to comment.