From 09d12e6727a45988613dd5baf0ce63126f22952c Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Tue, 14 Aug 2018 02:34:16 -0700 Subject: [PATCH] anv: Add support for I915_ENGINE_CLASS_COMPUTE in init_device_state() Signed-off-by: Jordan Justen Reviewed-by: Caio Oliveira Reviewed-by: Lionel Landwerlin Reviewed-by: Kenneth Graunke Part-of: --- src/intel/vulkan/genX_state.c | 54 ++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 7 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 } -#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; + 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 + 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;