From 605f3021f0eedf2114c5c6f1b2a2df48def88fce Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 14 Apr 2022 09:09:35 -0400 Subject: [PATCH] zink: make update_framebuffer_state() public this is useful Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 20 +++----------------- src/gallium/drivers/zink/zink_framebuffer.c | 14 ++++++++++++++ src/gallium/drivers/zink/zink_framebuffer.h | 3 +++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 710d56c0e8a..eb5afb42a9c 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -2119,20 +2119,6 @@ equals_framebuffer_imageless(const void *a, const void *b) return memcmp(a, b, offsetof(struct zink_framebuffer_state, infos) + sizeof(s->infos[0]) * s->num_attachments) == 0; } -static void -update_framebuffer_state(struct zink_context *ctx, int old_w, int old_h) -{ - if (ctx->fb_state.width != old_w || ctx->fb_state.height != old_h) - ctx->scissor_changed = true; - /* get_framebuffer adds a ref if the fb is reused or created; - * always do get_framebuffer first to avoid deleting the same fb - * we're about to use - */ - struct zink_framebuffer *fb = zink_get_framebuffer(ctx); - ctx->fb_changed |= ctx->framebuffer != fb; - ctx->framebuffer = fb; -} - static void setup_framebuffer(struct zink_context *ctx) { @@ -2185,7 +2171,7 @@ setup_framebuffer(struct zink_context *ctx) unsigned old_h = ctx->fb_state.height; ctx->fb_state.width = ctx->swapchain_size.width; ctx->fb_state.height = ctx->swapchain_size.height; - update_framebuffer_state(ctx, old_w, old_h); + zink_update_framebuffer_state(ctx, old_w, old_h); ctx->swapchain_size.width = ctx->swapchain_size.height = 0; } @@ -2697,7 +2683,7 @@ zink_set_color_write_enables(struct zink_context *ctx) /* use dummy color buffers instead of the more sane option */ zink_end_render_pass(ctx); ctx->rp_changed = true; - update_framebuffer_state(ctx, ctx->fb_state.width, ctx->fb_state.height); + zink_update_framebuffer_state(ctx, ctx->fb_state.width, ctx->fb_state.height); } else { reapply_color_write(ctx); } @@ -2774,7 +2760,7 @@ zink_set_framebuffer_state(struct pipe_context *pctx, } rebind_fb_state(ctx, NULL, true); ctx->fb_state.samples = MAX2(samples, 1); - update_framebuffer_state(ctx, w, h); + zink_update_framebuffer_state(ctx, w, h); uint8_t rast_samples = ctx->fb_state.samples - 1; if (rast_samples != ctx->gfx_pipeline_state.rast_samples) diff --git a/src/gallium/drivers/zink/zink_framebuffer.c b/src/gallium/drivers/zink/zink_framebuffer.c index f6ab4807403..ec83d3e26fc 100644 --- a/src/gallium/drivers/zink/zink_framebuffer.c +++ b/src/gallium/drivers/zink/zink_framebuffer.c @@ -207,3 +207,17 @@ debug_describe_zink_framebuffer(char* buf, const struct zink_framebuffer *ptr) { sprintf(buf, "zink_framebuffer"); } + +void +zink_update_framebuffer_state(struct zink_context *ctx, int old_w, int old_h) +{ + if (ctx->fb_state.width != old_w || ctx->fb_state.height != old_h) + ctx->scissor_changed = true; + /* get_framebuffer adds a ref if the fb is reused or created; + * always do get_framebuffer first to avoid deleting the same fb + * we're about to use + */ + struct zink_framebuffer *fb = zink_get_framebuffer(ctx); + ctx->fb_changed |= ctx->framebuffer != fb; + ctx->framebuffer = fb; +} diff --git a/src/gallium/drivers/zink/zink_framebuffer.h b/src/gallium/drivers/zink/zink_framebuffer.h index 7c55c6101fe..24d0dbf46d7 100644 --- a/src/gallium/drivers/zink/zink_framebuffer.h +++ b/src/gallium/drivers/zink/zink_framebuffer.h @@ -84,4 +84,7 @@ zink_framebuffer_reference(struct zink_screen *screen, struct zink_framebuffer * zink_get_framebuffer(struct zink_context *ctx); + +void +zink_update_framebuffer_state(struct zink_context *ctx, int old_w, int old_h); #endif