mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
zink: rework flush_frontbuffer to always flush
previously this would no-op unacquired swapchains and then try to execute a copy from the last-presented swapchain image to the current image to avoid presenting garbage data instead, just present garbage like the app requested fixes #7165 Tested-By: Matti Hamalainen <ccr@tnsp.org> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18730>
This commit is contained in:
parent
758c559bc4
commit
babf9474c4
1 changed files with 15 additions and 12 deletions
|
|
@ -1496,12 +1496,21 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen,
|
||||||
struct zink_resource *res = zink_resource(pres);
|
struct zink_resource *res = zink_resource(pres);
|
||||||
struct zink_context *ctx = zink_context(pctx);
|
struct zink_context *ctx = zink_context(pctx);
|
||||||
|
|
||||||
/* if the surface has never been acquired, there's nothing to present,
|
/* if the surface is no longer a swapchain, this is a no-op */
|
||||||
* so this is a no-op */
|
if (!zink_is_swapchain(res))
|
||||||
if (!zink_is_swapchain(res) || (!zink_kopper_acquired(res->obj->dt, res->obj->dt_idx) && res->obj->last_dt_idx == UINT32_MAX))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ctx = zink_tc_context_unwrap(pctx);
|
ctx = zink_tc_context_unwrap(pctx);
|
||||||
|
|
||||||
|
if (!zink_kopper_acquired(res->obj->dt, res->obj->dt_idx)) {
|
||||||
|
/* swapbuffers to an undefined surface: acquire and present garbage */
|
||||||
|
zink_kopper_acquire(ctx, res, UINT64_MAX);
|
||||||
|
ctx->needs_present = res;
|
||||||
|
/* set batch usage to submit acquire semaphore */
|
||||||
|
zink_batch_resource_usage_set(&ctx->batch, res, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* handle any outstanding acquire submits (not just from above) */
|
||||||
if (ctx->batch.swapchain || ctx->needs_present) {
|
if (ctx->batch.swapchain || ctx->needs_present) {
|
||||||
ctx->batch.has_work = true;
|
ctx->batch.has_work = true;
|
||||||
pctx->flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME);
|
pctx->flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME);
|
||||||
|
|
@ -1511,15 +1520,9 @@ zink_flush_frontbuffer(struct pipe_screen *pscreen,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zink_kopper_acquired(res->obj->dt, res->obj->dt_idx))
|
/* always verify that this was acquired */
|
||||||
zink_kopper_present_queue(screen, res);
|
assert(zink_kopper_acquired(res->obj->dt, res->obj->dt_idx));
|
||||||
else {
|
zink_kopper_present_queue(screen, res);
|
||||||
assert(res->obj->last_dt_idx != UINT32_MAX);
|
|
||||||
if (!zink_kopper_last_present_eq(res->obj->dt, res->obj->last_dt_idx)) {
|
|
||||||
zink_kopper_acquire_readback(ctx, res);
|
|
||||||
zink_kopper_present_readback(ctx, res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue