Mesa (master): zink: add a flag indicating whether scanout object needs updating

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 21 14:27:45 UTC 2021


Module: Mesa
Branch: master
Commit: 4dcd477d123e62f144210c6b624627f9c42d5924
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4dcd477d123e62f144210c6b624627f9c42d5924

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Apr 20 15:04:11 2021 -0400

zink: add a flag indicating whether scanout object needs updating

this minimizes overhead of maintaining scanout objects

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

Reviewed-by: Adam Jackson <ajax at redhat.com>
Acked-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10358>

---

 src/gallium/drivers/zink/zink_batch.c    | 4 ++++
 src/gallium/drivers/zink/zink_resource.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c
index ae696b347f7..7fe5f860d40 100644
--- a/src/gallium/drivers/zink/zink_batch.c
+++ b/src/gallium/drivers/zink/zink_batch.c
@@ -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)
diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h
index c298c8fe3d2..74234e56055 100644
--- a/src/gallium/drivers/zink/zink_resource.h
+++ b/src/gallium/drivers/zink/zink_resource.h
@@ -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 {



More information about the mesa-commit mailing list