Mesa (main): zink: break up swapchain renderpass update to util function

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 20 16:58:32 UTC 2022


Module: Mesa
Branch: main
Commit: e107fa386bdafc03944d38c7ec56edb475e3784b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e107fa386bdafc03944d38c7ec56edb475e3784b

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue May 10 12:18:19 2022 -0400

zink: break up swapchain renderpass update to util function

no functional changes

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16476>

---

 src/gallium/drivers/zink/zink_render_pass.c | 46 ++++++++++++++++-------------
 src/gallium/drivers/zink/zink_render_pass.h |  2 ++
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_render_pass.c b/src/gallium/drivers/zink/zink_render_pass.c
index f51623cf74e..16b07e261b4 100644
--- a/src/gallium/drivers/zink/zink_render_pass.c
+++ b/src/gallium/drivers/zink/zink_render_pass.c
@@ -431,26 +431,7 @@ setup_framebuffer(struct zink_context *ctx)
    }
 
    ctx->rp_changed = false;
-   bool has_swapchain = false;
-   for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
-      if (!ctx->fb_state.cbufs[i])
-         continue;
-      struct zink_resource *res = zink_resource(ctx->fb_state.cbufs[i]->texture);
-      if (zink_is_swapchain(res)) {
-         has_swapchain = true;
-         if (zink_kopper_acquire(ctx, res, UINT64_MAX))
-            zink_surface_swapchain_update(ctx, zink_csurface(ctx->fb_state.cbufs[i]));
-      }
-   }
-   if (has_swapchain && (ctx->swapchain_size.width || ctx->swapchain_size.height)) {
-      unsigned old_w = ctx->fb_state.width;
-      unsigned old_h = ctx->fb_state.height;
-      ctx->fb_state.width = ctx->swapchain_size.width;
-      ctx->fb_state.height = ctx->swapchain_size.height;
-      zink_kopper_fixup_depth_buffer(ctx);
-      zink_update_framebuffer_state(ctx, old_w, old_h);
-      ctx->swapchain_size.width = ctx->swapchain_size.height = 0;
-   }
+   zink_render_update_swapchain(ctx);
 
    if (!ctx->fb_changed)
       return;
@@ -664,3 +645,28 @@ zink_init_render_pass(struct zink_context *ctx)
                                                     equals_render_pass_state);
    return !!ctx->render_pass_cache;
 }
+
+void
+zink_render_update_swapchain(struct zink_context *ctx)
+{
+   bool has_swapchain = false;
+   for (unsigned i = 0; i < ctx->fb_state.nr_cbufs; i++) {
+      if (!ctx->fb_state.cbufs[i])
+         continue;
+      struct zink_resource *res = zink_resource(ctx->fb_state.cbufs[i]->texture);
+      if (zink_is_swapchain(res)) {
+         has_swapchain = true;
+         if (zink_kopper_acquire(ctx, res, UINT64_MAX))
+            zink_surface_swapchain_update(ctx, zink_csurface(ctx->fb_state.cbufs[i]));
+      }
+   }
+   if (has_swapchain && (ctx->swapchain_size.width || ctx->swapchain_size.height)) {
+      unsigned old_w = ctx->fb_state.width;
+      unsigned old_h = ctx->fb_state.height;
+      ctx->fb_state.width = ctx->swapchain_size.width;
+      ctx->fb_state.height = ctx->swapchain_size.height;
+      zink_kopper_fixup_depth_buffer(ctx);
+      zink_update_framebuffer_state(ctx, old_w, old_h);
+      ctx->swapchain_size.width = ctx->swapchain_size.height = 0;
+   }
+}
diff --git a/src/gallium/drivers/zink/zink_render_pass.h b/src/gallium/drivers/zink/zink_render_pass.h
index f98d066ea64..a7579a776f5 100644
--- a/src/gallium/drivers/zink/zink_render_pass.h
+++ b/src/gallium/drivers/zink/zink_render_pass.h
@@ -100,4 +100,6 @@ zink_render_pass_attachment_get_barrier_info(const struct zink_render_pass *rp,
 
 bool
 zink_init_render_pass(struct zink_context *ctx);
+void
+zink_render_update_swapchain(struct zink_context *ctx);
 #endif



More information about the mesa-commit mailing list