iris: Implement Gen12 workaround for non pipelined state
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 13 Jan 2020 15:50:06 +0000 (17:50 +0200)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Tue, 14 Jan 2020 09:52:36 +0000 (11:52 +0200)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3365>

src/gallium/drivers/iris/iris_state.c

index a0917761ac6ac4955c1f63437e8863dd5b14dab7..67d9f758ef7c8b151eb553fba0b25d84d90be94f 100644 (file)
@@ -1014,12 +1014,24 @@ iris_init_compute_context(struct iris_batch *batch)
 {
    UNUSED const struct gen_device_info *devinfo = &batch->screen->devinfo;
 
+   /* GEN:BUG:1607854226:
+    *
+    *  Start with pipeline in 3D mode to set the STATE_BASE_ADDRESS.
+    */
+#if GEN_GEN == 12
+   emit_pipeline_select(batch, _3D);
+#else
    emit_pipeline_select(batch, GPGPU);
+#endif
 
    iris_emit_default_l3_config(batch, devinfo, true);
 
    init_state_base_address(batch);
 
+#if GEN_GEN == 12
+   emit_pipeline_select(batch, GPGPU);
+#endif
+
 #if GEN_GEN == 9
    if (devinfo->is_geminilake)
       init_glk_barrier_mode(batch, GLK_BARRIER_MODE_GPGPU);
@@ -5030,6 +5042,20 @@ iris_update_surface_base_address(struct iris_batch *batch,
 
    flush_before_state_base_change(batch);
 
+#if GEN_GEN == 12
+   /* GEN:BUG:1607854226:
+    *
+    *  Workaround the non pipelined state not applying in MEDIA/GPGPU pipeline
+    *  mode by putting the pipeline temporarily in 3D mode..
+    */
+   if (batch->name == IRIS_BATCH_COMPUTE) {
+      iris_emit_cmd(batch, GENX(PIPELINE_SELECT), sel) {
+         sel.MaskBits = 3;
+         sel.PipelineSelection = _3D;
+      }
+   }
+#endif
+
    iris_emit_cmd(batch, GENX(STATE_BASE_ADDRESS), sba) {
       sba.SurfaceStateBaseAddressModifyEnable = true;
       sba.SurfaceStateBaseAddress = ro_bo(binder->bo, 0);
@@ -5048,6 +5074,19 @@ iris_update_surface_base_address(struct iris_batch *batch,
 #endif
    }
 
+#if GEN_GEN == 12
+   /* GEN:BUG:1607854226:
+    *
+    *  Put the pipeline back into compute mode.
+    */
+   if (batch->name == IRIS_BATCH_COMPUTE) {
+      iris_emit_cmd(batch, GENX(PIPELINE_SELECT), sel) {
+         sel.MaskBits = 3;
+         sel.PipelineSelection = GPGPU;
+      }
+   }
+#endif
+
    flush_after_state_base_change(batch);
 
    batch->last_surface_base_address = binder->bo->gtt_offset;