![]() |
|
|||
0001 /* 0002 * Copyright © 2016 Intel Corporation 0003 * 0004 * Permission is hereby granted, free of charge, to any person obtaining a 0005 * copy of this software and associated documentation files (the "Software"), 0006 * to deal in the Software without restriction, including without limitation 0007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 0008 * and/or sell copies of the Software, and to permit persons to whom the 0009 * Software is furnished to do so, subject to the following conditions: 0010 * 0011 * The above copyright notice and this permission notice (including the next 0012 * paragraph) shall be included in all copies or substantial portions of the 0013 * Software. 0014 * 0015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0018 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 0020 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 0021 * IN THE SOFTWARE. 0022 * 0023 */ 0024 0025 #include "gem/selftests/igt_gem_utils.h" 0026 #include "gt/mock_engine.h" 0027 0028 #include "mock_request.h" 0029 0030 struct i915_request * 0031 mock_request(struct intel_context *ce, unsigned long delay) 0032 { 0033 struct i915_request *request; 0034 0035 /* NB the i915->requests slab cache is enlarged to fit mock_request */ 0036 request = intel_context_create_request(ce); 0037 if (IS_ERR(request)) 0038 return NULL; 0039 0040 request->mock.delay = delay; 0041 return request; 0042 } 0043 0044 bool mock_cancel_request(struct i915_request *request) 0045 { 0046 struct mock_engine *engine = 0047 container_of(request->engine, typeof(*engine), base); 0048 bool was_queued; 0049 0050 spin_lock_irq(&engine->hw_lock); 0051 was_queued = !list_empty(&request->mock.link); 0052 list_del_init(&request->mock.link); 0053 spin_unlock_irq(&engine->hw_lock); 0054 0055 if (was_queued) 0056 i915_request_unsubmit(request); 0057 0058 return was_queued; 0059 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |