drm/i915: Only copy back the modified fields to userspace from execbuffer
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 23 May 2014 09:45:52 +0000 (10:45 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 11 Jul 2014 12:33:37 +0000 (13:33 +0100)
commit0984f60dc8ba393d3779257ccdc20f74c9372cbf
treeb95ebcb804570eb1fec3eb73de7afd3789e50c83
parentd4e82f5f4228f5a45abadd48a408b3745f61e3f8
drm/i915: Only copy back the modified fields to userspace from execbuffer

commit 9aab8bff7aa3bee567213ad3c1fdfb217bb980a2 upstream.

We only want to modifiy a single field in the userspace view of the
execbuffer command buffer, so explicitly change that rather than copy
everything back again.

This serves two purposes:

1. The single fields are much cheaper to copy (constant size so the
copy uses special case code) and much smaller than the whole array.

2. We modify the array for internal use that need to be masked from
the user.

Note: We need this backported since without it the next bugfix will
blow up when userspace recycles batchbuffers and relocations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[bwh: Backported to 3.2: to_user_ptr() is open-coded]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/gpu/drm/i915/i915_gem_execbuffer.c