| .. | .. |
|---|
| 22 | 22 | * |
|---|
| 23 | 23 | */ |
|---|
| 24 | 24 | |
|---|
| 25 | | -#include "mock_engine.h" |
|---|
| 25 | +#include "gem/selftests/igt_gem_utils.h" |
|---|
| 26 | +#include "gt/mock_engine.h" |
|---|
| 27 | + |
|---|
| 26 | 28 | #include "mock_request.h" |
|---|
| 27 | 29 | |
|---|
| 28 | 30 | struct i915_request * |
|---|
| 29 | | -mock_request(struct intel_engine_cs *engine, |
|---|
| 30 | | - struct i915_gem_context *context, |
|---|
| 31 | | - unsigned long delay) |
|---|
| 31 | +mock_request(struct intel_context *ce, unsigned long delay) |
|---|
| 32 | 32 | { |
|---|
| 33 | 33 | struct i915_request *request; |
|---|
| 34 | | - struct mock_request *mock; |
|---|
| 35 | 34 | |
|---|
| 36 | 35 | /* NB the i915->requests slab cache is enlarged to fit mock_request */ |
|---|
| 37 | | - request = i915_request_alloc(engine, context); |
|---|
| 36 | + request = intel_context_create_request(ce); |
|---|
| 38 | 37 | if (IS_ERR(request)) |
|---|
| 39 | 38 | return NULL; |
|---|
| 40 | 39 | |
|---|
| 41 | | - mock = container_of(request, typeof(*mock), base); |
|---|
| 42 | | - mock->delay = delay; |
|---|
| 43 | | - |
|---|
| 44 | | - return &mock->base; |
|---|
| 40 | + request->mock.delay = delay; |
|---|
| 41 | + return request; |
|---|
| 45 | 42 | } |
|---|
| 46 | 43 | |
|---|
| 47 | 44 | bool mock_cancel_request(struct i915_request *request) |
|---|
| 48 | 45 | { |
|---|
| 49 | | - struct mock_request *mock = container_of(request, typeof(*mock), base); |
|---|
| 50 | 46 | struct mock_engine *engine = |
|---|
| 51 | 47 | container_of(request->engine, typeof(*engine), base); |
|---|
| 52 | 48 | bool was_queued; |
|---|
| 53 | 49 | |
|---|
| 54 | 50 | spin_lock_irq(&engine->hw_lock); |
|---|
| 55 | | - was_queued = !list_empty(&mock->link); |
|---|
| 56 | | - list_del_init(&mock->link); |
|---|
| 51 | + was_queued = !list_empty(&request->mock.link); |
|---|
| 52 | + list_del_init(&request->mock.link); |
|---|
| 57 | 53 | spin_unlock_irq(&engine->hw_lock); |
|---|
| 58 | 54 | |
|---|
| 59 | 55 | if (was_queued) |
|---|