zink: move swapchain from zink_batch to zink_context

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29108>
This commit is contained in:
Mike Blumenkrantz 2024-05-08 10:49:12 -04:00 committed by Marge Bot
parent 2837cf9dde
commit 107bf9ec7c
4 changed files with 8 additions and 9 deletions

View file

@ -823,12 +823,12 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
ctx->work_count = 0;
/* this is swapchain presentation semaphore handling */
if (batch->swapchain) {
if (zink_kopper_acquired(batch->swapchain->obj->dt, batch->swapchain->obj->dt_idx) && !batch->swapchain->obj->present) {
batch->state->present = zink_kopper_present(screen, batch->swapchain);
batch->state->swapchain = batch->swapchain;
if (ctx->swapchain) {
if (zink_kopper_acquired(ctx->swapchain->obj->dt, ctx->swapchain->obj->dt_idx) && !ctx->swapchain->obj->present) {
batch->state->present = zink_kopper_present(screen, ctx->swapchain);
batch->state->swapchain = ctx->swapchain;
}
batch->swapchain = NULL;
ctx->swapchain = NULL;
}
if (screen->device_lost)

View file

@ -4168,7 +4168,7 @@ zink_flush_resource(struct pipe_context *pctx,
} else {
ctx->needs_present = res;
}
ctx->batch.swapchain = res;
ctx->swapchain = res;
} else if (res->dmabuf)
res->queue = VK_QUEUE_FAMILY_FOREIGN_EXT;
}

View file

@ -1843,7 +1843,7 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen,
}
/* handle any outstanding acquire submits (not just from above) */
if (ctx->batch.swapchain || ctx->needs_present) {
if (ctx->swapchain || ctx->needs_present) {
ctx->batch.state->has_work = true;
pctx->flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME);
if (ctx->last_batch_state && screen->threaded_submit) {

View file

@ -677,8 +677,6 @@ zink_batch_state(struct zink_fence *fence)
struct zink_batch {
struct zink_batch_state *state;
struct zink_resource *swapchain;
};
@ -1871,6 +1869,7 @@ struct zink_context {
struct set rendering_state_cache[6]; //[util_logbase2_ceil(msrtss samplecount)]
struct set render_pass_state_cache;
struct hash_table *render_pass_cache;
struct zink_resource *swapchain;
VkExtent2D swapchain_size;
bool fb_changed;
bool in_rp; //renderpass is currently active