obj->view_prune_count = 0;
obj->view_prune_timeline = 0;
simple_mtx_unlock(&obj->view_lock);
+ if (obj->dt)
+ zink_kopper_prune_batch_usage(obj->dt, &bs->usage);
} else if (util_dynarray_num_elements(&obj->views, VkBufferView) > MAX_VIEW_COUNT && !zink_bo_has_unflushed_usage(obj->bo)) {
/* avoid ballooning from too many views on always-used resources: */
simple_mtx_lock(&obj->view_lock);
continue;
return;
}
+ struct zink_batch_usage *u = cswap->batch_uses;
+ if (!zink_screen_usage_check_completion(screen, u)) {
+ /* these can't ever be pruned */
+ if (!wait || zink_batch_usage_is_unflushed(u))
+ return;
+
+ zink_screen_timeline_wait(screen, u->usage, UINT64_MAX);
+ cswap->batch_uses = NULL;
+ }
cdt->old_swapchain = cswap->next;
destroy_swapchain(screen, cswap);
}
} else if (is_swapchain_kill(ret)) {
kill_swapchain(ctx, res);
}
- return !is_swapchain_kill(ret);
+ bool is_kill = is_swapchain_kill(ret);
+ zink_batch_usage_set(&cdt->swapchain->batch_uses, ctx->batch.state);
+ return !is_kill;
}
VkSemaphore
res->base.b.width0 = ctx->swapchain_size.width;
res->base.b.height0 = ctx->swapchain_size.height;
}
+ zink_batch_usage_set(&cdt->swapchain->batch_uses, ctx->batch.state);
return true;
}
return cdt->swapchain->images[res->obj->dt_idx].age;
}
+
+static void
+swapchain_prune_batch_usage(struct kopper_swapchain *cswap, const struct zink_batch_usage *u)
+{
+ if (cswap->batch_uses == u)
+ cswap->batch_uses = NULL;
+}
+
+void
+zink_kopper_prune_batch_usage(struct kopper_displaytarget *cdt, const struct zink_batch_usage *u)
+{
+ struct kopper_swapchain *cswap = cdt->swapchain;
+ swapchain_prune_batch_usage(cswap, u);
+ for (cswap = cdt->old_swapchain; cswap; cswap = cswap->next)
+ swapchain_prune_batch_usage(cswap, u);
+}
extern "C" {
#endif
+struct zink_batch_usage;
+
struct kopper_swapchain_image {
bool init;
bool acquired;
unsigned num_acquires;
unsigned max_acquires;
unsigned async_presents;
+ struct zink_batch_usage *batch_uses;
struct kopper_swapchain_image *images;
};
zink_kopper_set_swap_interval(struct pipe_screen *pscreen, struct pipe_resource *pres, int interval);
int
zink_kopper_query_buffer_age(struct pipe_context *pctx, struct pipe_resource *pres);
+void
+zink_kopper_prune_batch_usage(struct kopper_displaytarget *cdt, const struct zink_batch_usage *u);
#ifdef __cplusplus
}