Skip to content

Commit 0db3633

Browse files
ickledanvet
authored andcommitted
drm/i915/gt: Move engine setup out of set_default_submission
Now that we no longer switch back and forth between guc and execlists, we no longer need to restore the backend's vfunc and can leave them set after initialisation. The only catch is that we lose the submission on wedging and still need to reset the submit_request vfunc on unwedging. Signed-off-by: Matthew Brost <[email protected]> Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 50c3ffb commit 0db3633

File tree

3 files changed

+44
-56
lines changed

3 files changed

+44
-56
lines changed

drivers/gpu/drm/i915/gt/intel_execlists_submission.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,29 +3076,6 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine)
30763076
engine->submit_request = execlists_submit_request;
30773077
engine->schedule = i915_schedule;
30783078
engine->execlists.tasklet.callback = execlists_submission_tasklet;
3079-
3080-
engine->reset.prepare = execlists_reset_prepare;
3081-
engine->reset.rewind = execlists_reset_rewind;
3082-
engine->reset.cancel = execlists_reset_cancel;
3083-
engine->reset.finish = execlists_reset_finish;
3084-
3085-
engine->park = execlists_park;
3086-
engine->unpark = NULL;
3087-
3088-
engine->flags |= I915_ENGINE_SUPPORTS_STATS;
3089-
if (!intel_vgpu_active(engine->i915)) {
3090-
engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
3091-
if (can_preempt(engine)) {
3092-
engine->flags |= I915_ENGINE_HAS_PREEMPTION;
3093-
if (IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
3094-
engine->flags |= I915_ENGINE_HAS_TIMESLICES;
3095-
}
3096-
}
3097-
3098-
if (intel_engine_has_preemption(engine))
3099-
engine->emit_bb_start = gen8_emit_bb_start;
3100-
else
3101-
engine->emit_bb_start = gen8_emit_bb_start_noarb;
31023079
}
31033080

31043081
static void execlists_shutdown(struct intel_engine_cs *engine)
@@ -3129,6 +3106,14 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)
31293106
engine->cops = &execlists_context_ops;
31303107
engine->request_alloc = execlists_request_alloc;
31313108

3109+
engine->reset.prepare = execlists_reset_prepare;
3110+
engine->reset.rewind = execlists_reset_rewind;
3111+
engine->reset.cancel = execlists_reset_cancel;
3112+
engine->reset.finish = execlists_reset_finish;
3113+
3114+
engine->park = execlists_park;
3115+
engine->unpark = NULL;
3116+
31323117
engine->emit_flush = gen8_emit_flush_xcs;
31333118
engine->emit_init_breadcrumb = gen8_emit_init_breadcrumb;
31343119
engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_xcs;
@@ -3149,6 +3134,21 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)
31493134
* until a more refined solution exists.
31503135
*/
31513136
}
3137+
3138+
engine->flags |= I915_ENGINE_SUPPORTS_STATS;
3139+
if (!intel_vgpu_active(engine->i915)) {
3140+
engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
3141+
if (can_preempt(engine)) {
3142+
engine->flags |= I915_ENGINE_HAS_PREEMPTION;
3143+
if (IS_ACTIVE(CONFIG_DRM_I915_TIMESLICE_DURATION))
3144+
engine->flags |= I915_ENGINE_HAS_TIMESLICES;
3145+
}
3146+
}
3147+
3148+
if (intel_engine_has_preemption(engine))
3149+
engine->emit_bb_start = gen8_emit_bb_start;
3150+
else
3151+
engine->emit_bb_start = gen8_emit_bb_start_noarb;
31523152
}
31533153

31543154
static void logical_ring_default_irqs(struct intel_engine_cs *engine)

drivers/gpu/drm/i915/gt/intel_ring_submission.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -989,14 +989,10 @@ static void gen6_bsd_submit_request(struct i915_request *request)
989989
static void i9xx_set_default_submission(struct intel_engine_cs *engine)
990990
{
991991
engine->submit_request = i9xx_submit_request;
992-
993-
engine->park = NULL;
994-
engine->unpark = NULL;
995992
}
996993

997994
static void gen6_bsd_set_default_submission(struct intel_engine_cs *engine)
998995
{
999-
i9xx_set_default_submission(engine);
1000996
engine->submit_request = gen6_bsd_submit_request;
1001997
}
1002998

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -608,35 +608,6 @@ static int guc_resume(struct intel_engine_cs *engine)
608608
static void guc_set_default_submission(struct intel_engine_cs *engine)
609609
{
610610
engine->submit_request = guc_submit_request;
611-
engine->schedule = i915_schedule;
612-
engine->execlists.tasklet.callback = guc_submission_tasklet;
613-
614-
engine->reset.prepare = guc_reset_prepare;
615-
engine->reset.rewind = guc_reset_rewind;
616-
engine->reset.cancel = guc_reset_cancel;
617-
engine->reset.finish = guc_reset_finish;
618-
619-
engine->flags |= I915_ENGINE_NEEDS_BREADCRUMB_TASKLET;
620-
engine->flags |= I915_ENGINE_HAS_PREEMPTION;
621-
622-
/*
623-
* TODO: GuC supports timeslicing and semaphores as well, but they're
624-
* handled by the firmware so some minor tweaks are required before
625-
* enabling.
626-
*
627-
* engine->flags |= I915_ENGINE_HAS_TIMESLICES;
628-
* engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
629-
*/
630-
631-
engine->emit_bb_start = gen8_emit_bb_start;
632-
633-
/*
634-
* For the breadcrumb irq to work we need the interrupts to stay
635-
* enabled. However, on all platforms on which we'll have support for
636-
* GuC submission we don't allow disabling the interrupts at runtime, so
637-
* we're always safe with the current flow.
638-
*/
639-
GEM_BUG_ON(engine->irq_enable || engine->irq_disable);
640611
}
641612

642613
static void guc_release(struct intel_engine_cs *engine)
@@ -658,6 +629,13 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine)
658629
engine->cops = &guc_context_ops;
659630
engine->request_alloc = guc_request_alloc;
660631

632+
engine->schedule = i915_schedule;
633+
634+
engine->reset.prepare = guc_reset_prepare;
635+
engine->reset.rewind = guc_reset_rewind;
636+
engine->reset.cancel = guc_reset_cancel;
637+
engine->reset.finish = guc_reset_finish;
638+
661639
engine->emit_flush = gen8_emit_flush_xcs;
662640
engine->emit_init_breadcrumb = gen8_emit_init_breadcrumb;
663641
engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_xcs;
@@ -666,6 +644,20 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine)
666644
engine->emit_flush = gen12_emit_flush_xcs;
667645
}
668646
engine->set_default_submission = guc_set_default_submission;
647+
648+
engine->flags |= I915_ENGINE_NEEDS_BREADCRUMB_TASKLET;
649+
engine->flags |= I915_ENGINE_HAS_PREEMPTION;
650+
651+
/*
652+
* TODO: GuC supports timeslicing and semaphores as well, but they're
653+
* handled by the firmware so some minor tweaks are required before
654+
* enabling.
655+
*
656+
* engine->flags |= I915_ENGINE_HAS_TIMESLICES;
657+
* engine->flags |= I915_ENGINE_HAS_SEMAPHORES;
658+
*/
659+
660+
engine->emit_bb_start = gen8_emit_bb_start;
669661
}
670662

671663
static void rcs_submission_override(struct intel_engine_cs *engine)

0 commit comments

Comments
 (0)