zink: add a flag indicating whether scanout object needs updating

this minimizes overhead of maintaining scanout objects

Fixes: 104603fa76 ("zink: create separate linear tiling image for scanout")

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10358>
This commit is contained in:
Mike Blumenkrantz 2021-04-20 15:04:11 -04:00 committed by Marge Bot
parent dd8b15b2bb
commit 4dcd477d12
2 changed files with 5 additions and 0 deletions

View file

@ -362,6 +362,8 @@ copy_scanout(struct zink_context *ctx, struct zink_resource *res)
struct pipe_box *src_box = &box;
unsigned dstz = 0;
if (!res->scanout_dirty)
return;
region.srcSubresource.aspectMask = res->aspect;
region.srcSubresource.mipLevel = 0;
switch (res->base.b.target) {
@ -469,6 +471,7 @@ copy_scanout(struct zink_context *ctx, struct zink_resource *res)
);
/* separate flag to avoid annoying validation errors for new scanout objs */
res->scanout_obj_init = true;
res->scanout_dirty = false;
}
void
@ -555,6 +558,7 @@ zink_batch_reference_resource_rw(struct zink_batch *batch, struct zink_resource
zink_batch_usage_set(&stencil->obj->writes, batch->state->fence.batch_id);
zink_batch_usage_set(&res->obj->writes, batch->state->fence.batch_id);
}
res->scanout_dirty = !!res->scanout_obj;
} else {
if (res->obj->reads.usage != batch->state->fence.batch_id) {
if (stencil)

View file

@ -90,6 +90,7 @@ struct zink_resource {
struct zink_resource_object *obj;
struct zink_resource_object *scanout_obj; //TODO: remove for wsi
bool scanout_obj_init;
bool scanout_dirty;
union {
struct util_range valid_buffer_range;
struct {