c/main: Refactor out wait idle to own function

This commit is contained in:
Jakob Bornecrantz 2021-02-22 20:28:10 +00:00
parent 616b7f6ae0
commit 48c2fe1f87

View file

@ -143,6 +143,14 @@ renderer_create(struct comp_renderer *r, struct comp_compositor *c)
r->rrs = NULL; r->rrs = NULL;
} }
static void
renderer_wait_gpu_idle(struct comp_renderer *r)
{
os_mutex_lock(&r->c->vk.queue_mutex);
r->c->vk.vkDeviceWaitIdle(r->c->vk.device);
os_mutex_unlock(&r->c->vk.queue_mutex);
}
static void static void
renderer_submit_queue(struct comp_renderer *r) renderer_submit_queue(struct comp_renderer *r)
{ {
@ -630,9 +638,7 @@ comp_renderer_draw(struct comp_renderer *r)
* *
* This is done after a swap so isn't time critical. * This is done after a swap so isn't time critical.
*/ */
os_mutex_lock(&r->c->vk.queue_mutex); renderer_wait_gpu_idle(r);
r->c->vk.vkDeviceWaitIdle(r->c->vk.device);
os_mutex_unlock(&r->c->vk.queue_mutex);
} }
static void static void