UPSTREAM: drm/i915: Allow userspace to hint that the relocations were known

Userspace is able to hint to the kernel that its command stream and
auxiliary state buffers already hold the correct presumed addresses and
so the relocation process may be skipped if the kernel does not need to
move any buffers in preparation for the execbuffer. Thus for the common
case where the allotment of buffers is static between batches, we can
avoid the overhead of individually checking the relocation entries.

Note that this requires userspace to supply the domain tracking and
requests for workarounds itself that would otherwise be computed based
upon the relocation entries.

Using copywinwin10 as an example that is dependent upon emitting a lot
of relocations (2 per operation), we see improvements of:

c2d/gm45: 618000.0/sec to 632000.0/sec.
i3-330m: 748000.0/sec to 830000.0/sec.

(measured relative to a baseline with neither optimisations applied).

BUG=chromium:781060
TEST=test_that link graphics_VTSwitch --iteration 10
     and manually check if the screen is corrupted.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Imre Deak <imre.deak@intel.com>
[danvet: Fixup merge conflict in userspace header due to different
baseline trees.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit ed5982e6ce5f106abcbf071f80730db344a6da42)
Signed-off-by: Po-Hsien Wang <pwang@chromium.org>

Change-Id: Ic4603b81a53c2f631e8e3fcb828f7f59e6ee2f0a
Reviewed-on: https://chromium-review.googlesource.com/810212
Commit-Ready: Po-Hsien Wang <pwang@chromium.org>
Tested-by: Po-Hsien Wang <pwang@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
(cherry picked from commit 9cc3363a3c20e7e7610183cb23312a5fc3b6cfd1)
Reviewed-on: https://chromium-review.googlesource.com/848552
Reviewed-by: Po-Hsien Wang <pwang@chromium.org>
3 files changed