mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 08:30:10 +01:00
zink: fix partial update handling
* the damage region was not being used correctly (this is a normal rect) * use_damage was never unset at frame boundary * original renderArea was never re-set Fixes:3d38c9597f("zink: hook up KHR_partial_update") Acked-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30625> (cherry picked from commita7f64c6203)
This commit is contained in:
parent
2521bf243c
commit
fdfe33d69d
4 changed files with 29 additions and 6 deletions
|
|
@ -684,7 +684,7 @@
|
|||
"description": "zink: fix partial update handling",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "3d38c9597ff3b687026fa4c664f8b4aa20b97f53",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -2913,8 +2913,14 @@ begin_rendering(struct zink_context *ctx)
|
|||
if (has_swapchain) {
|
||||
ASSERTED struct zink_resource *res = zink_resource(ctx->fb_state.cbufs[0]->texture);
|
||||
zink_render_fixup_swapchain(ctx);
|
||||
if (res->use_damage)
|
||||
if (res->use_damage) {
|
||||
ctx->dynamic_fb.info.renderArea = res->damage;
|
||||
} else {
|
||||
ctx->dynamic_fb.info.renderArea.offset.x = 0;
|
||||
ctx->dynamic_fb.info.renderArea.offset.y = 0;
|
||||
ctx->dynamic_fb.info.renderArea.extent.width = ctx->fb_state.width;
|
||||
ctx->dynamic_fb.info.renderArea.extent.height = ctx->fb_state.height;
|
||||
}
|
||||
/* clamp for late swapchain resize */
|
||||
if (res->base.b.width0 < ctx->dynamic_fb.info.renderArea.extent.width)
|
||||
ctx->dynamic_fb.info.renderArea.extent.width = res->base.b.width0;
|
||||
|
|
|
|||
|
|
@ -877,6 +877,8 @@ zink_kopper_present_queue(struct zink_screen *screen, struct zink_resource *res,
|
|||
kopper_present(cpi, screen, -1);
|
||||
}
|
||||
res->obj->indefinite_acquire = false;
|
||||
res->use_damage = false;
|
||||
memset(&res->damage, 0, sizeof(res->damage));
|
||||
cdt->swapchain->images[res->obj->dt_idx].acquired = NULL;
|
||||
res->obj->dt_idx = UINT32_MAX;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1546,10 +1546,25 @@ zink_set_damage_region(struct pipe_screen *pscreen, struct pipe_resource *pres,
|
|||
|
||||
for (unsigned i = 0; i < nrects; i++) {
|
||||
int y = pres->height0 - rects[i].y - rects[i].height;
|
||||
res->damage.extent.width = MAX2(res->damage.extent.width, rects[i].x + rects[i].width);
|
||||
res->damage.extent.height = MAX2(res->damage.extent.height, y + rects[i].height);
|
||||
res->damage.offset.x = MIN2(res->damage.offset.x, rects[i].x);
|
||||
res->damage.offset.y = MIN2(res->damage.offset.y, y);
|
||||
/* convert back to coord-based rects to use coordinate calcs */
|
||||
struct u_rect currect = {
|
||||
.x0 = res->damage.offset.x,
|
||||
.y0 = res->damage.offset.y,
|
||||
.x1 = res->damage.offset.x + res->damage.extent.width,
|
||||
.y1 = res->damage.offset.y + res->damage.extent.height,
|
||||
};
|
||||
struct u_rect newrect = {
|
||||
.x0 = rects[i].x,
|
||||
.y0 = y,
|
||||
.x1 = rects[i].x + rects[i].width,
|
||||
.y1 = y + rects[i].height,
|
||||
};
|
||||
struct u_rect u;
|
||||
u_rect_union(&u, &currect, &newrect);
|
||||
res->damage.extent.width = u.y1 - u.y0;
|
||||
res->damage.extent.height = u.x1 - u.x0;
|
||||
res->damage.offset.x = u.x0;
|
||||
res->damage.offset.y = u.y0;
|
||||
}
|
||||
|
||||
res->use_damage = nrects > 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue