i965: Stop restoring the default L3 configuration on Kernel 4.16+.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 16 Feb 2018 19:03:58 +0000 (11:03 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 17 Feb 2018 19:26:18 +0000 (11:26 -0800)
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@riseup.net>
src/mesa/drivers/dri/i965/intel_batchbuffer.c
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.h

index 8a2b4218608dd553e6f4f83fd766d49bf0228d2b..d0999bb3caad947c9f418a2c5d941c08b6017a4c 100644 (file)
@@ -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) {
index 768634d92e0c9f4749304a797364bca986f274d7..f9e799f9a35a100a83e129215a90a9a086466106 100644 (file)
@@ -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 =
index ef2d08974ed5b14ac705be5d2c23940ee1d11cb5..a2bce9214496619cdd58ff4258d6ac10a57db2a4 100644 (file)
@@ -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;