From 643d7b4b703dffe4be508a502a8ffc87843cb61c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 16 Mar 2026 12:23:14 -0400 Subject: [PATCH] freedreno: clean up some surface management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- .../drivers/freedreno/freedreno_blitter.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.c b/src/gallium/drivers/freedreno/freedreno_blitter.c index d5ac714d3a4..e5c61a7a963 100644 --- a/src/gallium/drivers/freedreno/freedreno_blitter.c +++ b/src/gallium/drivers/freedreno/freedreno_blitter.c @@ -29,6 +29,7 @@ default_dst_texture(struct pipe_surface *dst_templ, struct pipe_resource *dst, unsigned dstlevel, unsigned dstz) { memset(dst_templ, 0, sizeof(*dst_templ)); + dst_templ->texture = dst; dst_templ->level = dstlevel; dst_templ->first_layer = dstz; dst_templ->last_layer = dstz; @@ -214,7 +215,7 @@ fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info) struct pipe_resource *dst = info->dst.resource; struct pipe_resource *src = info->src.resource; struct pipe_context *pipe = &ctx->base; - struct pipe_surface *dst_view, dst_templ; + struct pipe_surface dst_templ; struct pipe_sampler_view src_templ, *src_view; void *fs = NULL; @@ -223,7 +224,6 @@ fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info) /* Initialize the surface. */ default_dst_texture(&dst_templ, dst, info->dst.level, info->dst.box.z); dst_templ.format = info->dst.format; - dst_view = pipe->create_surface(pipe, dst, &dst_templ); /* Initialize the sampler view. */ default_src_texture(&src_templ, src, info->src.level); @@ -255,12 +255,11 @@ fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info) /* Copy. */ util_blitter_blit_generic( - ctx->blitter, dst_view, &info->dst.box, src_view, &info->src.box, + ctx->blitter, &dst_templ, &info->dst.box, src_view, &info->src.box, src->width0, src->height0, info->mask, info->filter, info->scissor_enable ? &info->scissor : NULL, info->alpha_blend, false, 0, fs); - pipe_surface_reference(&dst_view, NULL); pipe_sampler_view_reference(&src_view, NULL); fd_blitter_pipe_end(ctx); @@ -399,17 +398,14 @@ static void fd_blit_stencil_fallback(struct fd_context *ctx, const struct pipe_blit_info *info) assert_dt { - struct pipe_context *pctx = &ctx->base; - struct pipe_surface *dst_view, dst_templ; + struct pipe_surface dst_templ; util_blitter_default_dst_texture(&dst_templ, info->dst.resource, info->dst.level, info->dst.box.z); - dst_view = pctx->create_surface(pctx, info->dst.resource, &dst_templ); - fd_blitter_prep(ctx, info); - util_blitter_clear_depth_stencil(ctx->blitter, dst_view, PIPE_CLEAR_STENCIL, + util_blitter_clear_depth_stencil(ctx->blitter, &dst_templ, PIPE_CLEAR_STENCIL, 0, 0, info->dst.box.x, info->dst.box.y, info->dst.box.width, info->dst.box.height); @@ -419,8 +415,6 @@ fd_blit_stencil_fallback(struct fd_context *ctx, const struct pipe_blit_info *in ctx->blitter, info->dst.resource, info->dst.level, &info->dst.box, info->src.resource, info->src.level, &info->src.box, info->scissor_enable ? &info->scissor : NULL); - - pipe_surface_unref(pctx, &dst_view); } /**