<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 3/31/2023 2:12 AM, Lionel Landwerlin
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:20230330204228.2781676-1-lionel.g.landwerlin@intel.com">
      <pre class="moz-quote-pre" wrap="">By default the indirect state sampler data (border colors) are stored
in the same heap as the SAMPLER_STATE structure. For userspace drivers
that can be 2 different heaps (dynamic state heap & bindless sampler
state heap). This means that border colors have to copied in 2
different places so that the same SAMPLER_STATE structure find the
right data.

This change is forcing the indirect state sampler data to only be in
the dynamic state pool (more convinient for userspace drivers, they
only have to have one copy of the border colors). This is reproducing
the behavior of the Windows drivers.

BSpec: 46052

Signed-off-by: Lionel Landwerlin <a class="moz-txt-link-rfc2396E" href="mailto:lionel.g.landwerlin@intel.com"><lionel.g.landwerlin@intel.com></a>
Cc: <a class="moz-txt-link-abbreviated" href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a>
---
 drivers/gpu/drm/i915/gt/intel_gt_regs.h     |  1 +
 drivers/gpu/drm/i915/gt/intel_workarounds.c | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index 4aecb5a7b6318..f298dc461a72f 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -1144,6 +1144,7 @@
 #define   ENABLE_SMALLPL                       REG_BIT(15)
 #define   SC_DISABLE_POWER_OPTIMIZATION_EBB    REG_BIT(9)
 #define   GEN11_SAMPLER_ENABLE_HEADLESS_MSG    REG_BIT(5)
+#define   GEN11_INDIRECT_STATE_BASE_ADDR_OVERRIDE      REG_BIT(0)
 
 #define GEN9_HALF_SLICE_CHICKEN7               MCR_REG(0xe194)
 #define   DG2_DISABLE_ROUND_ENABLE_ALLOW_FOR_SSLA      REG_BIT(15)
diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c
index e7ee24bcad893..5bfc864d5fcc0 100644
--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
@@ -2971,6 +2971,25 @@ general_render_compute_wa_init(struct intel_engine_cs *engine, struct i915_wa_li
 
        add_render_compute_tuning_settings(i915, wal);
 
+       if (GRAPHICS_VER(i915) >= 11) {
+               /* This is not a Wa (although referred to as
+                * WaSetInidrectStateOverride in places), this allows
+                * applications that reference sampler states through
+                * the BindlessSamplerStateBaseAddress to have their
+                * border color relative to DynamicStateBaseAddress
+                * rather than BindlessSamplerStateBaseAddress.
+                *
+                * Otherwise SAMPLER_STATE border colors have to be
+                * copied in multiple heaps (DynamicStateBaseAddress &
+                * BindlessSamplerStateBaseAddress)
+                *
+                * BSpec: 46052
+                */
+               wa_mcr_masked_en(wal,
+                                GEN10_SAMPLER_MODE,
+                                GEN11_INDIRECT_STATE_BASE_ADDR_OVERRIDE);
+       }
+</pre>
    </blockquote>
    <p style="margin:0in;font-family:Verdana;font-size:11.0pt">Looks
      Good to me.</p>
    <p style="margin:0in;font-family:Verdana;font-size:11.0pt">Reviewed-by:
      Haridhar Kalvala <a class="moz-txt-link-rfc2396E" href="mailto:haridhar.kalvala@intel.com"><haridhar.kalvala@intel.com></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
        EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA"><br>
      </span></p>
    <blockquote type="cite" cite="mid:20230330204228.2781676-1-lionel.g.landwerlin@intel.com">
      <pre class="moz-quote-pre" wrap="">
        if (IS_MTL_GRAPHICS_STEP(i915, M, STEP_A0, STEP_B0) ||
            IS_MTL_GRAPHICS_STEP(i915, P, STEP_A0, STEP_B0) ||
            IS_DG2_GRAPHICS_STEP(i915, G10, STEP_B0, STEP_FOREVER) ||
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Regards,
Haridhar Kalvala</pre>
  </body>
</html>