zink: add a param to allow zink_screen_update_pipeline_cache to run directly

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18197>
This commit is contained in:
Mike Blumenkrantz 2022-08-12 11:30:08 -04:00 committed by Marge Bot
parent e1ad7bf0b7
commit b2696ca58e
4 changed files with 8 additions and 5 deletions

View file

@ -993,7 +993,7 @@ zink_get_compute_pipeline(struct zink_screen *screen,
if (pipeline == VK_NULL_HANDLE)
return VK_NULL_HANDLE;
zink_screen_update_pipeline_cache(screen, &comp->base);
zink_screen_update_pipeline_cache(screen, &comp->base, false);
if (!comp->use_local_size && !comp->curr->num_uniforms && !comp->curr->has_nonseamless) {
/* don't add base pipeline to cache */
state->pipeline = comp->base_pipeline = pipeline;

View file

@ -251,7 +251,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
if (pipeline == VK_NULL_HANDLE)
return VK_NULL_HANDLE;
zink_screen_update_pipeline_cache(screen, &prog->base);
zink_screen_update_pipeline_cache(screen, &prog->base, false);
struct gfx_pipeline_cache_entry *pc_entry = CALLOC_STRUCT(gfx_pipeline_cache_entry);
if (!pc_entry)
return VK_NULL_HANDLE;

View file

@ -231,12 +231,15 @@ cache_put_job(void *data, void *gdata, int thread_index)
}
void
zink_screen_update_pipeline_cache(struct zink_screen *screen, struct zink_program *pg)
zink_screen_update_pipeline_cache(struct zink_screen *screen, struct zink_program *pg, bool in_thread)
{
if (!screen->disk_cache)
return;
util_queue_add_job(&screen->cache_put_thread, pg, &pg->cache_fence, cache_put_job, NULL, 0);
if (in_thread)
cache_put_job(pg, screen, 0);
else
util_queue_add_job(&screen->cache_put_thread, pg, &pg->cache_fence, cache_put_job, NULL, 0);
}
static void

View file

@ -108,7 +108,7 @@ zink_is_depth_format_supported(struct zink_screen *screen, VkFormat format);
#define GET_PROC_ADDR_INSTANCE_LOCAL(screen, instance, x) PFN_vk##x vk_##x = (PFN_vk##x)(screen)->vk_GetInstanceProcAddr(instance, "vk"#x)
void
zink_screen_update_pipeline_cache(struct zink_screen *screen, struct zink_program *pg);
zink_screen_update_pipeline_cache(struct zink_screen *screen, struct zink_program *pg, bool in_thread);
void
zink_screen_get_pipeline_cache(struct zink_screen *screen, struct zink_program *pg, bool in_thread);