zink: fix/improve swapchain surface info updating

if the swapchain is updated, the base surface info needs to be updated
so that the surface info used for the framebuffer is updated

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16151>
This commit is contained in:
Mike Blumenkrantz 2022-04-25 15:43:40 -04:00 committed by Marge Bot
parent 25840a31eb
commit 305fe87d98
2 changed files with 10 additions and 2 deletions

View file

@ -502,8 +502,11 @@ zink_kopper_acquire(struct zink_context *ctx, struct zink_resource *res, uint64_
res->base.b.height0 != cswap->scci.imageExtent.height;
VkResult ret = kopper_acquire(zink_screen(ctx->base.screen), res, timeout);
if (ret == VK_SUCCESS || ret == VK_SUBOPTIMAL_KHR) {
if (cswap != cdt->swapchain)
if (cswap != cdt->swapchain) {
ctx->swapchain_size = cdt->swapchain->scci.imageExtent;
res->base.b.width0 = ctx->swapchain_size.width;
res->base.b.height0 = ctx->swapchain_size.height;
}
} else if (is_swapchain_kill(ret)) {
kill_swapchain(ctx, res);
}
@ -664,8 +667,11 @@ zink_kopper_acquire_readback(struct zink_context *ctx, struct zink_resource *res
return false;
}
}
if (cswap != cdt->swapchain)
if (cswap != cdt->swapchain) {
ctx->swapchain_size = cdt->swapchain->scci.imageExtent;
res->base.b.width0 = ctx->swapchain_size.width;
res->base.b.height0 = ctx->swapchain_size.height;
}
return true;
}

View file

@ -434,6 +434,8 @@ zink_surface_swapchain_update(struct zink_context *ctx, struct zink_surface *sur
surface->old_swapchain_size = surface->swapchain_size;
surface->swapchain_size = cdt->swapchain->num_images;
surface->swapchain = calloc(surface->swapchain_size, sizeof(VkImageView));
surface->base.width = res->base.b.width0;
surface->base.height = res->base.b.height0;
init_surface_info(surface, res, &surface->ivci);
}
if (!surface->swapchain[res->obj->dt_idx]) {