diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-11-20 05:20:02 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-11-20 10:56:16 -0500 |
commit | 3fef5cda970124a15c553c1672d800e40fc08a9e (patch) | |
tree | 6ba9c24bca258c8e3bab90a01d29fdfa4fdb9fc1 /drivers/gpu/drm/i915/intel_ringbuffer.c | |
parent | 2113184c6f6749f6e4e86a42894f67a50ead6775 (diff) |
drm/i915: Automatic i915_switch_context for legacy
During request construction, after pinning the context we know whether
or not we have to emit a context switch. So move this common operation
from every caller into i915_gem_request_alloc() itself.
v2: Always submit the request if we emitted some commands during request
construction, as typically it also involves changes in global state.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171120102002.22254-2-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 12e734b29463..be98868115bf 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1592,6 +1592,10 @@ static int ring_request_alloc(struct drm_i915_gem_request *request) | |||
1592 | if (ret) | 1592 | if (ret) |
1593 | return ret; | 1593 | return ret; |
1594 | 1594 | ||
1595 | ret = i915_switch_context(request); | ||
1596 | if (ret) | ||
1597 | return ret; | ||
1598 | |||
1595 | request->reserved_space -= LEGACY_REQUEST_SIZE; | 1599 | request->reserved_space -= LEGACY_REQUEST_SIZE; |
1596 | return 0; | 1600 | return 0; |
1597 | } | 1601 | } |