gallium: add a pipe_context param to pipe_surface_reference()

this shouldn't be used anymore, but for anyone still using it there
needs to be a context passed

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
This commit is contained in:
Mike Blumenkrantz 2026-03-16 12:33:47 -04:00 committed by Marge Bot
parent 169c140ec3
commit e8ced90aab
7 changed files with 20 additions and 22 deletions

View file

@ -140,6 +140,7 @@ typedef void (*pipe_surface_destroy_func)(struct pipe_context*, struct pipe_surf
static inline void
pipe_surface_reference(struct pipe_surface **dst, struct pipe_surface *src,
struct pipe_context *pipe,
pipe_surface_destroy_func surface_destroy)
{
struct pipe_surface *old_dst = *dst;
@ -148,7 +149,7 @@ pipe_surface_reference(struct pipe_surface **dst, struct pipe_surface *src,
src ? &src->reference : NULL,
(debug_reference_descriptor)
debug_describe_surface))
surface_destroy(old_dst->context, old_dst);
surface_destroy(pipe, old_dst);
*dst = src;
}

View file

@ -135,13 +135,6 @@ delete_sampler_view(set_entry *entry)
pipe_sampler_view_reference(&pres, NULL);
}
static void
delete_surface(set_entry *entry)
{
struct pipe_surface *surf = (struct pipe_surface *)entry->key;
pipe_surface_reference(&surf, NULL, (pipe_surface_destroy_func)d3d12_surface_destroy);
}
static void
delete_object(set_entry *entry)
{
@ -173,7 +166,10 @@ d3d12_reset_batch(struct d3d12_context *ctx, struct d3d12_batch *batch, uint64_t
}
_mesa_hash_table_clear(batch->bos, delete_bo_entry);
_mesa_set_clear(batch->surfaces, delete_surface);
set_foreach_remove(batch->surfaces, entry) {
struct pipe_surface *surf = (struct pipe_surface *)entry->key;
pipe_surface_reference(&surf, NULL, &ctx->base, (pipe_surface_destroy_func)d3d12_surface_destroy);
}
_mesa_set_clear(batch->objects, delete_object);
util_dynarray_foreach(&batch->local_bos, d3d12_bo*, bo) {

View file

@ -528,7 +528,7 @@ void r300_decompress_zmask_locked(struct r300_context *r300)
r300->context.set_framebuffer_state(&r300->context, &saved_fb);
util_unreference_framebuffer_state(&saved_fb);
pipe_surface_reference(&r300->locked_zbuffer, NULL, r300_surface_destroy);
pipe_surface_reference(&r300->locked_zbuffer, NULL, &r300->context, r300_surface_destroy);
}
bool r300_is_blit_supported(enum pipe_format format)
@ -691,7 +691,7 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
false, false, 0, NULL);
r300_blitter_end(r300);
pipe_surface_reference(&dst_view, NULL, r300_surface_destroy);
pipe_surface_reference(&dst_view, NULL, &r300->context, r300_surface_destroy);
pipe_sampler_view_reference(&src_view, NULL);
}

View file

@ -48,7 +48,7 @@ static void r300_release_referenced_objects(struct r300_context *r300)
/* Manually-created vertex buffers. */
pipe_vertex_buffer_unreference(&r300->dummy_vb);
pipe_surface_reference(&r300->locked_zbuffer, NULL, r300_surface_destroy);
pipe_surface_reference(&r300->locked_zbuffer, NULL, &r300->context, r300_surface_destroy);
radeon_bo_reference(r300->rws, &r300->vbo, NULL);
r300->context.delete_depth_stencil_alpha_state(&r300->context,

View file

@ -1079,7 +1079,7 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
}
} else {
/* We don't bind another zbuffer, so lock the current one. */
pipe_surface_reference(&r300->locked_zbuffer, r300->fb_zsbuf, r300_surface_destroy);
pipe_surface_reference(&r300->locked_zbuffer, r300->fb_zsbuf, pipe, r300_surface_destroy);
}
} else if (r300->locked_zbuffer) {
/* We have a locked zbuffer now, what are we gonna do? */
@ -1146,7 +1146,7 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
r300_set_blend_color(pipe, &((struct r300_blend_color_state*)r300->blend_color_state.state)->state);
if (unlock_zbuffer) {
pipe_surface_reference(&r300->locked_zbuffer, NULL, r300_surface_destroy);
pipe_surface_reference(&r300->locked_zbuffer, NULL, pipe, r300_surface_destroy);
}
r300_mark_fb_state_dirty(r300, R300_CHANGED_FB_STATE);

View file

@ -63,7 +63,7 @@ emit_fb_vgpu9(struct svga_context *svga)
return ret;
svga_surface_reference(&svga->state.hw_clear.framebuffer.cbufs[i],
svga->curr.framebuffer.cbufs[i]);
svga->curr.framebuffer.cbufs[i], &svga->pipe);
}
/* Set the rendered-to flag */
@ -98,7 +98,7 @@ emit_fb_vgpu9(struct svga_context *svga)
}
svga_surface_reference(&svga->state.hw_clear.framebuffer.zsbuf,
svga->curr.framebuffer.zsbuf);
svga->curr.framebuffer.zsbuf, &svga->pipe);
/* Set the rendered-to flag */
struct svga_surface *s = currfb->zsbuf;
@ -245,12 +245,12 @@ emit_fb_vgpu10(struct svga_context *svga)
/* Free the alternate surface view when it is unbound. */
pipe_surface_unref(&svga->pipe, &svga->state.hw_clear.rtv[i], svga_surface_destroy);
}
svga_surface_reference(&hwfb->cbufs[i], currfb->cbufs[i]);
svga_surface_reference(&hwfb->cbufs[i], currfb->cbufs[i], &svga->pipe);
}
}
svga->state.hw_clear.num_rendertargets = last_rtv + 1;
for (unsigned i = 0; i < num_color; i++) {
pipe_surface_reference(&svga->state.hw_clear.rtv[i], rtv[i], svga_surface_destroy);
pipe_surface_reference(&svga->state.hw_clear.rtv[i], rtv[i], &svga->pipe, svga_surface_destroy);
}
hwfb->base.nr_cbufs = currfb->base.nr_cbufs;
@ -263,9 +263,9 @@ emit_fb_vgpu10(struct svga_context *svga)
/* Free the alternate surface view when it is unbound. */
pipe_surface_unref(&svga->pipe, &svga->state.hw_clear.dsv, svga_surface_destroy);
}
svga_surface_reference(&hwfb->zsbuf, currfb->zsbuf);
svga_surface_reference(&hwfb->zsbuf, currfb->zsbuf, &svga->pipe);
}
pipe_surface_reference(&svga->state.hw_clear.dsv, dsv, svga_surface_destroy);
pipe_surface_reference(&svga->state.hw_clear.dsv, dsv, &svga->pipe, svga_surface_destroy);
}
return PIPE_OK;

View file

@ -171,11 +171,12 @@ svga_resource_type(enum pipe_texture_target target)
static inline void
svga_surface_reference(struct svga_surface **dst,
struct svga_surface *src)
struct svga_surface *src,
struct pipe_context *pipe)
{
pipe_surface_reference((struct pipe_surface **) dst,
(struct pipe_surface *) src,
svga_surface_destroy);
pipe, svga_surface_destroy);
}