Mesa (master): i965: Stop restoring the default L3 configuration on Kernel 4.16+.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Feb 17 19:27:53 UTC 2018


Module: Mesa
Branch: master
Commit: a63c74be851e3d9ddc3bc6ae162346463b1daef3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a63c74be851e3d9ddc3bc6ae162346463b1daef3

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Feb 16 11:03:58 2018 -0800

i965: Stop restoring the default L3 configuration on Kernel 4.16+.

Kernel 4.16 has proper context isolation, which means we can change
the L3 configuration without worrying about that leaking to other
newly created contexts, breaking the assumptions of other userspace.

So, disable our workaround to reprogram it back to the default.

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

---

 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 5 +++--
 src/mesa/drivers/dri/i965/intel_screen.c      | 3 +++
 src/mesa/drivers/dri/i965/intel_screen.h      | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 8a2b421860..d0999bb3ca 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -739,9 +739,10 @@ brw_finish_batch(struct brw_context *brw)
    if (brw->batch.ring == RENDER_RING) {
       /* Work around L3 state leaks into contexts set MI_RESTORE_INHIBIT which
        * assume that the L3 cache is configured according to the hardware
-       * defaults.
+       * defaults.  On Kernel 4.16+, we no longer need to do this.
        */
-      if (devinfo->gen >= 7)
+      if (devinfo->gen >= 7 &&
+          !(brw->screen->kernel_features & KERNEL_ALLOWS_CONTEXT_ISOLATION))
          gen7_restore_default_l3_config(brw);
 
       if (devinfo->is_haswell) {
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 768634d92e..f9e799f9a3 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -2660,6 +2660,9 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen)
    if (devinfo->gen >= 8 || screen->cmd_parser_version >= 5)
       screen->kernel_features |= KERNEL_ALLOWS_COMPUTE_DISPATCH;
 
+   if (intel_get_boolean(screen, I915_PARAM_HAS_CONTEXT_ISOLATION))
+      screen->kernel_features |= KERNEL_ALLOWS_CONTEXT_ISOLATION;
+
    const char *force_msaa = getenv("INTEL_FORCE_MSAA");
    if (force_msaa) {
       screen->winsys_msaa_samples_override =
diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h
index ef2d08974e..a2bce92144 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.h
+++ b/src/mesa/drivers/dri/i965/intel_screen.h
@@ -81,6 +81,7 @@ struct intel_screen
 #define KERNEL_ALLOWS_COMPUTE_DISPATCH              (1<<4)
 #define KERNEL_ALLOWS_EXEC_CAPTURE                  (1<<5)
 #define KERNEL_ALLOWS_EXEC_BATCH_FIRST              (1<<6)
+#define KERNEL_ALLOWS_CONTEXT_ISOLATION             (1<<7)
 
    struct brw_bufmgr *bufmgr;
 




More information about the mesa-commit mailing list