drm/i915: refactor i915_gem_object_pin_map()
authorDave Gordon <david.s.gordon@intel.com>
Fri, 20 May 2016 10:54:04 +0000 (11:54 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 20 May 2016 12:42:36 +0000 (13:42 +0100)
commitdd6034c67a50a4f6895e5bded512e0dd4bf58918
tree89d8a706612b01aaa5b0ef755d9fdf64d8e37414
parentdc00b6a07c2206e7b7dbcbeff856049264c40faa
drm/i915: refactor i915_gem_object_pin_map()

The recently-added i915_gem_object_pin_map() can be further optimised
for "small" objects. To facilitate this, and simplify the error paths
before adding the new code, this patch pulls out the "mapping" part of
the operation (involving local allocations which must be undone before
return) into its own subfunction.

The next patch will then insert the new optimisation into the middle of
the now-separated subfunction.

This reorganisation will probably not affect the generated code, as the
compiler will most likely inline it anyway, but it makes the logical
structure a bit clearer and easier to modify.

v2:
    Restructure loop-over-pages & error check [Chris Wilson]

v3:
    Add page count to debug messages [Chris Wilson]
    Convert WARN_ON() to GEM_BUG_ON()

v4:
    Drop the DEBUG messages [Tvrtko Ursulin]

Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1463741647-15666-2-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c