1 /* 2 * SPDX-License-Identifier: MIT 3 * 4 * Copyright © 2018 Intel Corporation 5 */ 6 7 #include "igt_gem_utils.h" 8 9 #include "gem/i915_gem_context.h" 10 #include "gem/i915_gem_pm.h" 11 #include "gt/intel_context.h" 12 13 #include "i915_request.h" 14 15 struct i915_request * 16 igt_request_alloc(struct i915_gem_context *ctx, struct intel_engine_cs *engine) 17 { 18 struct intel_context *ce; 19 struct i915_request *rq; 20 21 /* 22 * Pinning the contexts may generate requests in order to acquire 23 * GGTT space, so do this first before we reserve a seqno for 24 * ourselves. 25 */ 26 ce = i915_gem_context_get_engine(ctx, engine->id); 27 if (IS_ERR(ce)) 28 return ERR_CAST(ce); 29 30 rq = intel_context_create_request(ce); 31 intel_context_put(ce); 32 33 return rq; 34 } 35