Lines Matching full:engine
46 static struct intel_ring *mock_ring(struct intel_engine_cs *engine) in mock_ring() argument
66 static struct i915_request *first_request(struct mock_engine *engine) in first_request() argument
68 return list_first_entry_or_null(&engine->hw_queue, in first_request()
79 intel_engine_queue_breadcrumbs(request->engine); in advance()
84 struct mock_engine *engine = from_timer(engine, t, hw_delay); in hw_delay_complete() local
88 spin_lock_irqsave(&engine->hw_lock, flags); in hw_delay_complete()
91 request = first_request(engine); in hw_delay_complete()
99 while ((request = first_request(engine))) { in hw_delay_complete()
101 mod_timer(&engine->hw_delay, in hw_delay_complete()
109 spin_unlock_irqrestore(&engine->hw_lock, flags); in hw_delay_complete()
133 ce->ring = mock_ring(ce->engine); in mock_context_alloc()
138 ce->timeline = intel_timeline_create(ce->engine->gt, NULL); in mock_context_alloc()
140 kfree(ce->engine); in mock_context_alloc()
187 struct mock_engine *engine = in mock_submit_request() local
188 container_of(request->engine, typeof(*engine), base); in mock_submit_request()
193 spin_lock_irqsave(&engine->hw_lock, flags); in mock_submit_request()
194 list_add_tail(&request->mock.link, &engine->hw_queue); in mock_submit_request()
195 if (list_is_first(&request->mock.link, &engine->hw_queue)) { in mock_submit_request()
197 mod_timer(&engine->hw_delay, in mock_submit_request()
202 spin_unlock_irqrestore(&engine->hw_lock, flags); in mock_submit_request()
205 static void mock_reset_prepare(struct intel_engine_cs *engine) in mock_reset_prepare() argument
209 static void mock_reset(struct intel_engine_cs *engine, bool stalled) in mock_reset() argument
214 static void mock_reset_finish(struct intel_engine_cs *engine) in mock_reset_finish() argument
218 static void mock_cancel_requests(struct intel_engine_cs *engine) in mock_cancel_requests() argument
223 spin_lock_irqsave(&engine->active.lock, flags); in mock_cancel_requests()
226 list_for_each_entry(request, &engine->active.requests, sched.link) { in mock_cancel_requests()
233 spin_unlock_irqrestore(&engine->active.lock, flags); in mock_cancel_requests()
240 struct mock_engine *engine; in mock_engine() local
244 engine = kzalloc(sizeof(*engine) + PAGE_SIZE, GFP_KERNEL); in mock_engine()
245 if (!engine) in mock_engine()
248 /* minimal engine setup for requests */ in mock_engine()
249 engine->base.i915 = i915; in mock_engine()
250 engine->base.gt = &i915->gt; in mock_engine()
251 snprintf(engine->base.name, sizeof(engine->base.name), "%s", name); in mock_engine()
252 engine->base.id = id; in mock_engine()
253 engine->base.mask = BIT(id); in mock_engine()
254 engine->base.instance = id; in mock_engine()
255 engine->base.status_page.addr = (void *)(engine + 1); in mock_engine()
257 engine->base.cops = &mock_context_ops; in mock_engine()
258 engine->base.request_alloc = mock_request_alloc; in mock_engine()
259 engine->base.emit_flush = mock_emit_flush; in mock_engine()
260 engine->base.emit_fini_breadcrumb = mock_emit_breadcrumb; in mock_engine()
261 engine->base.submit_request = mock_submit_request; in mock_engine()
263 engine->base.reset.prepare = mock_reset_prepare; in mock_engine()
264 engine->base.reset.reset = mock_reset; in mock_engine()
265 engine->base.reset.finish = mock_reset_finish; in mock_engine()
266 engine->base.cancel_requests = mock_cancel_requests; in mock_engine()
269 spin_lock_init(&engine->hw_lock); in mock_engine()
270 timer_setup(&engine->hw_delay, hw_delay_complete, 0); in mock_engine()
271 INIT_LIST_HEAD(&engine->hw_queue); in mock_engine()
273 intel_engine_add_user(&engine->base); in mock_engine()
275 return &engine->base; in mock_engine()
278 int mock_engine_init(struct intel_engine_cs *engine) in mock_engine_init() argument
282 intel_engine_init_active(engine, ENGINE_MOCK); in mock_engine_init()
283 intel_engine_init_breadcrumbs(engine); in mock_engine_init()
284 intel_engine_init_execlists(engine); in mock_engine_init()
285 intel_engine_init__pm(engine); in mock_engine_init()
286 intel_engine_pool_init(&engine->pool); in mock_engine_init()
288 ce = create_kernel_context(engine); in mock_engine_init()
292 engine->kernel_context = ce; in mock_engine_init()
296 intel_engine_fini_breadcrumbs(engine); in mock_engine_init()
300 void mock_engine_flush(struct intel_engine_cs *engine) in mock_engine_flush() argument
303 container_of(engine, typeof(*mock), base); in mock_engine_flush()
314 void mock_engine_reset(struct intel_engine_cs *engine) in mock_engine_reset() argument
318 void mock_engine_free(struct intel_engine_cs *engine) in mock_engine_free() argument
321 container_of(engine, typeof(*mock), base); in mock_engine_free()
325 intel_context_unpin(engine->kernel_context); in mock_engine_free()
326 intel_context_put(engine->kernel_context); in mock_engine_free()
328 intel_engine_fini_breadcrumbs(engine); in mock_engine_free()
330 kfree(engine); in mock_engine_free()