Mesa (main): anv: Add support for I915_ENGINE_CLASS_COMPUTE in init_device_state()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 09:35:54 UTC 2022


Module: Mesa
Branch: main
Commit: 09d12e6727a45988613dd5baf0ce63126f22952c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=09d12e6727a45988613dd5baf0ce63126f22952c

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Tue Aug 14 02:34:16 2018 -0700

anv: Add support for I915_ENGINE_CLASS_COMPUTE in init_device_state()

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14395>

---

 src/intel/vulkan/genX_state.c | 52 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 46 insertions(+), 6 deletions(-)

diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index b81b604206d..90b572c1953 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -158,6 +158,21 @@ genX(emit_slice_hashing_state)(struct anv_device *device,
 #endif
 }
 
+static void
+init_common_queue_state(struct anv_queue *queue, struct anv_batch *batch)
+{
+   UNUSED struct anv_device *device = queue->device;
+
+#if GFX_VER >= 11
+   /* Starting with GFX version 11, SLM is no longer part of the L3$ config
+    * so it never changes throughout the lifetime of the VkDevice.
+    */
+   const struct intel_l3_config *cfg = intel_get_default_l3_config(&device->info);
+   genX(emit_l3_config)(batch, device, cfg);
+   device->l3_config = cfg;
+#endif
+}
+
 static VkResult
 init_render_queue_state(struct anv_queue *queue)
 {
@@ -372,14 +387,36 @@ init_render_queue_state(struct anv_queue *queue)
 #endif
    }
 
+   init_common_queue_state(queue, &batch);
+
+   anv_batch_emit(&batch, GENX(MI_BATCH_BUFFER_END), bbe);
+
+   assert(batch.next <= batch.end);
+
+   return anv_queue_submit_simple_batch(queue, &batch);
+}
+
+static VkResult
+init_compute_queue_state(struct anv_queue *queue)
+{
+   struct anv_batch batch;
+
+   uint32_t cmds[64];
+   batch.start = batch.next = cmds;
+   batch.end = (void *) cmds + sizeof(cmds);
+
+   anv_batch_emit(&batch, GENX(PIPELINE_SELECT), ps) {
+#if GFX_VER >= 9
+      ps.MaskBits = 3;
+#endif
 #if GFX_VER >= 11
-   /* Starting with GFX version 11, SLM is no longer part of the L3$ config
-    * so it never changes throughout the lifetime of the VkDevice.
-    */
-   const struct intel_l3_config *cfg = intel_get_default_l3_config(&device->info);
-   genX(emit_l3_config)(&batch, device, cfg);
-   device->l3_config = cfg;
+      ps.MaskBits |= 0x10;
+      ps.MediaSamplerDOPClockGateEnable = true;
 #endif
+      ps.PipelineSelection = GPGPU;
+   }
+
+   init_common_queue_state(queue, &batch);
 
    anv_batch_emit(&batch, GENX(MI_BATCH_BUFFER_END), bbe);
 
@@ -406,6 +443,9 @@ genX(init_device_state)(struct anv_device *device)
       case I915_ENGINE_CLASS_RENDER:
          res = init_render_queue_state(queue);
          break;
+      case I915_ENGINE_CLASS_COMPUTE:
+         res = init_compute_queue_state(queue);
+         break;
       default:
          res = vk_error(device, VK_ERROR_INITIALIZATION_FAILED);
          break;



More information about the mesa-commit mailing list