From: Jordan Justen Date: Wed, 14 Nov 2018 18:49:05 +0000 (-0800) Subject: anv/pipeline: Split VFE/INTERFACE_DESCRIPTOR out to emit_media_cs_state X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=759b7f83dd713c2a41e4e39500b797afdddabde5;p=mesa.git anv/pipeline: Split VFE/INTERFACE_DESCRIPTOR out to emit_media_cs_state Signed-off-by: Jordan Justen Reviewed-by: Lionel Landwerlin Part-of: --- diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index a66e566bb99..b970df45915 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -2263,56 +2263,10 @@ genX(graphics_pipeline_create)( return pipeline->base.batch.status; } -static VkResult -compute_pipeline_create( - VkDevice _device, - struct anv_pipeline_cache * cache, - const VkComputePipelineCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkPipeline* pPipeline) +static void +emit_media_cs_state(struct anv_compute_pipeline *pipeline, + const struct anv_device *device) { - ANV_FROM_HANDLE(anv_device, device, _device); - const struct gen_device_info *devinfo = &device->info; - struct anv_compute_pipeline *pipeline; - VkResult result; - - assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO); - - /* Use the default pipeline cache if none is specified */ - if (cache == NULL && device->physical->instance->pipeline_cache_enabled) - cache = &device->default_pipeline_cache; - - pipeline = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (pipeline == NULL) - return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - - result = anv_pipeline_init(&pipeline->base, device, - ANV_PIPELINE_COMPUTE, pCreateInfo->flags, - pAllocator); - if (result != VK_SUCCESS) { - vk_free2(&device->vk.alloc, pAllocator, pipeline); - return result; - } - - anv_batch_set_storage(&pipeline->base.batch, ANV_NULL_ADDRESS, - pipeline->batch_data, sizeof(pipeline->batch_data)); - - pipeline->cs = NULL; - - assert(pCreateInfo->stage.stage == VK_SHADER_STAGE_COMPUTE_BIT); - ANV_FROM_HANDLE(anv_shader_module, module, pCreateInfo->stage.module); - result = anv_pipeline_compile_cs(pipeline, cache, pCreateInfo, module, - pCreateInfo->stage.pName, - pCreateInfo->stage.pSpecializationInfo); - if (result != VK_SUCCESS) { - anv_pipeline_finish(&pipeline->base, device, pAllocator); - vk_free2(&device->vk.alloc, pAllocator, pipeline); - if (result == VK_PIPELINE_COMPILE_REQUIRED_EXT) - *pPipeline = VK_NULL_HANDLE; - return result; - } - const struct brw_cs_prog_data *cs_prog_data = get_cs_prog_data(pipeline); anv_pipeline_setup_l3_config(&pipeline->base, cs_prog_data->base.total_shared > 0); @@ -2328,6 +2282,7 @@ compute_pipeline_create( const uint32_t subslices = MAX2(device->physical->subslice_total, 1); const struct anv_shader_bin *cs_bin = pipeline->cs; + const struct gen_device_info *devinfo = &device->info; anv_batch_emit(&pipeline->base.batch, GENX(MEDIA_VFE_STATE), vfe) { #if GEN_GEN > 7 @@ -2413,6 +2368,58 @@ compute_pipeline_create( GENX(INTERFACE_DESCRIPTOR_DATA_pack)(NULL, pipeline->interface_descriptor_data, &desc); +} + +static VkResult +compute_pipeline_create( + VkDevice _device, + struct anv_pipeline_cache * cache, + const VkComputePipelineCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipeline) +{ + ANV_FROM_HANDLE(anv_device, device, _device); + struct anv_compute_pipeline *pipeline; + VkResult result; + + assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO); + + /* Use the default pipeline cache if none is specified */ + if (cache == NULL && device->physical->instance->pipeline_cache_enabled) + cache = &device->default_pipeline_cache; + + pipeline = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + if (pipeline == NULL) + return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + + result = anv_pipeline_init(&pipeline->base, device, + ANV_PIPELINE_COMPUTE, pCreateInfo->flags, + pAllocator); + if (result != VK_SUCCESS) { + vk_free2(&device->vk.alloc, pAllocator, pipeline); + return result; + } + + anv_batch_set_storage(&pipeline->base.batch, ANV_NULL_ADDRESS, + pipeline->batch_data, sizeof(pipeline->batch_data)); + + pipeline->cs = NULL; + + assert(pCreateInfo->stage.stage == VK_SHADER_STAGE_COMPUTE_BIT); + ANV_FROM_HANDLE(anv_shader_module, module, pCreateInfo->stage.module); + result = anv_pipeline_compile_cs(pipeline, cache, pCreateInfo, module, + pCreateInfo->stage.pName, + pCreateInfo->stage.pSpecializationInfo); + if (result != VK_SUCCESS) { + anv_pipeline_finish(&pipeline->base, device, pAllocator); + vk_free2(&device->vk.alloc, pAllocator, pipeline); + if (result == VK_PIPELINE_COMPILE_REQUIRED_EXT) + *pPipeline = VK_NULL_HANDLE; + return result; + } + + emit_media_cs_state(pipeline, device); *pPipeline = anv_pipeline_to_handle(&pipeline->base);