]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/i915/execlists: Refactor out complete_preempt_context()
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 16 May 2018 18:33:50 +0000 (19:33 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 16 May 2018 19:20:34 +0000 (20:20 +0100)
As a complement to inject_preempt_context(), follow up with the function
to handle its completion. This will be useful should we wish to extend
the duties of the preempt-context for execlists.

v2: And do the same for the guc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jeff McGee <jeff.mcgee@intel.com>
Cc: MichaƂ Winiarski <michal.winiarski@intel.com>
Reviewed-by: Jeff McGee <jeff.mcgee@intel.com> #v1
Link: https://patchwork.freedesktop.org/patch/msgid/20180516183355.10553-3-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/intel_guc_submission.c
drivers/gpu/drm/i915/intel_lrc.c

index 2feb65096966519440a67092714bdcdec847db8f..ca38ac9ff4fadc02027777771e12ab78e9e980cb 100644 (file)
@@ -623,6 +623,21 @@ static void wait_for_guc_preempt_report(struct intel_engine_cs *engine)
        report->report_return_status = INTEL_GUC_REPORT_STATUS_UNKNOWN;
 }
 
+static void complete_preempt_context(struct intel_engine_cs *engine)
+{
+       struct intel_engine_execlists *execlists = &engine->execlists;
+
+       GEM_BUG_ON(!execlists_is_active(execlists, EXECLISTS_ACTIVE_PREEMPT));
+
+       execlists_cancel_port_requests(execlists);
+       execlists_unwind_incomplete_requests(execlists);
+
+       wait_for_guc_preempt_report(engine);
+       intel_write_status_page(engine, I915_GEM_HWS_PREEMPT_INDEX, 0);
+
+       execlists_clear_active(execlists, EXECLISTS_ACTIVE_PREEMPT);
+}
+
 /**
  * guc_submit() - Submit commands through GuC
  * @engine: engine associated with the commands
@@ -793,15 +808,8 @@ static void guc_submission_tasklet(unsigned long data)
 
        if (execlists_is_active(execlists, EXECLISTS_ACTIVE_PREEMPT) &&
            intel_read_status_page(engine, I915_GEM_HWS_PREEMPT_INDEX) ==
-           GUC_PREEMPT_FINISHED) {
-               execlists_cancel_port_requests(&engine->execlists);
-               execlists_unwind_incomplete_requests(execlists);
-
-               wait_for_guc_preempt_report(engine);
-
-               execlists_clear_active(execlists, EXECLISTS_ACTIVE_PREEMPT);
-               intel_write_status_page(engine, I915_GEM_HWS_PREEMPT_INDEX, 0);
-       }
+           GUC_PREEMPT_FINISHED)
+               complete_preempt_context(engine);
 
        if (!execlists_is_active(execlists, EXECLISTS_ACTIVE_PREEMPT))
                guc_dequeue(engine);
index 7c6164d14bd853e3a2570a7b7722ba897cbba44e..fafa0e9bd0cde70192fe23b7b4a5236bb6ba6427 100644 (file)
@@ -552,8 +552,18 @@ static void inject_preempt_context(struct intel_engine_cs *engine)
        if (execlists->ctrl_reg)
                writel(EL_CTRL_LOAD, execlists->ctrl_reg);
 
-       execlists_clear_active(&engine->execlists, EXECLISTS_ACTIVE_HWACK);
-       execlists_set_active(&engine->execlists, EXECLISTS_ACTIVE_PREEMPT);
+       execlists_clear_active(execlists, EXECLISTS_ACTIVE_HWACK);
+       execlists_set_active(execlists, EXECLISTS_ACTIVE_PREEMPT);
+}
+
+static void complete_preempt_context(struct intel_engine_execlists *execlists)
+{
+       GEM_BUG_ON(!execlists_is_active(execlists, EXECLISTS_ACTIVE_PREEMPT));
+
+       execlists_cancel_port_requests(execlists);
+       execlists_unwind_incomplete_requests(execlists);
+
+       execlists_clear_active(execlists, EXECLISTS_ACTIVE_PREEMPT);
 }
 
 static bool __execlists_dequeue(struct intel_engine_cs *engine)
@@ -1064,14 +1074,7 @@ static void execlists_submission_tasklet(unsigned long data)
                        if (status & GEN8_CTX_STATUS_COMPLETE &&
                            buf[2*head + 1] == execlists->preempt_complete_status) {
                                GEM_TRACE("%s preempt-idle\n", engine->name);
-
-                               execlists_cancel_port_requests(execlists);
-                               execlists_unwind_incomplete_requests(execlists);
-
-                               GEM_BUG_ON(!execlists_is_active(execlists,
-                                                               EXECLISTS_ACTIVE_PREEMPT));
-                               execlists_clear_active(execlists,
-                                                      EXECLISTS_ACTIVE_PREEMPT);
+                               complete_preempt_context(execlists);
                                continue;
                        }