diff options
author | Marek Olšák <marek.olsak@amd.com> | 2021-05-05 13:11:27 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-05-21 17:38:04 +0000 |
commit | b04044b3509c67f14fe482593eede12ae66abb54 (patch) | |
tree | 65a7d98288d16eaf09667936891e000b872c04b7 /src/gallium/drivers/radeonsi/si_texture.c | |
parent | 89eaf5909259ba6b80bab6ce4ab3fe2ab51c5286 (diff) |
radeonsi: stop using u_resource_vtbl::resource_destroy
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10659>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_texture.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_texture.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index 3a6b9caf64c..696cbbc11ff 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -784,20 +784,6 @@ static bool si_texture_get_handle(struct pipe_screen *screen, struct pipe_contex return sscreen->ws->buffer_get_handle(sscreen->ws, res->buf, whandle); } -static void si_texture_destroy(struct pipe_screen *screen, struct pipe_resource *ptex) -{ - struct si_texture *tex = (struct si_texture *)ptex; - struct si_resource *resource = &tex->buffer; - - si_texture_reference(&tex->flushed_depth_texture, NULL); - - if (tex->cmask_buffer != &tex->buffer) { - si_resource_reference(&tex->cmask_buffer, NULL); - } - radeon_bo_reference(((struct si_screen*)screen)->ws, &resource->buf, NULL); - FREE(tex); -} - static const struct u_resource_vtbl si_texture_vtbl; void si_print_texture_info(struct si_screen *sscreen, struct si_texture *tex, @@ -1445,36 +1431,8 @@ si_texture_create_with_modifiers(struct pipe_screen *screen, return si_texture_create_with_modifier(screen, templ, modifier); } -/* State trackers create separate textures in a next-chain for extra planes - * even if those are planes created purely for modifiers. Because the linking - * of the chain happens outside of the driver, and NULL is interpreted as - * failure, let's create some dummy texture structs. We could use these - * later to use the offsets for linking if we really wanted to. - * - * For now just create a dummy struct and completely ignore it. - * - * Potentially in the future we could store stride/offset and use it during - * creation, though we might want to change how linking is done first. - */ - -struct si_auxiliary_texture { - struct threaded_resource b; - struct pb_buffer *buffer; - uint32_t offset; - uint32_t stride; -}; - -static void si_auxiliary_texture_destroy(struct pipe_screen *screen, - struct pipe_resource *ptex) -{ - struct si_auxiliary_texture *tex = (struct si_auxiliary_texture *)ptex; - - radeon_bo_reference(((struct si_screen*)screen)->ws, &tex->buffer, NULL); - FREE(ptex); -} - static const struct u_resource_vtbl si_auxiliary_texture_vtbl = { - si_auxiliary_texture_destroy, /* resource_destroy */ + NULL, /* resource_destroy */ NULL, /* transfer_map */ NULL, /* transfer_unmap */ }; @@ -1625,6 +1583,7 @@ static struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen, if (!tex) return NULL; tex->b.b = *templ; + tex->b.b.flags |= SI_RESOURCE_AUX_PLANE; tex->b.vtbl = &si_auxiliary_texture_vtbl; tex->stride = whandle->stride; tex->offset = whandle->offset; @@ -1960,7 +1919,7 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_tran } static const struct u_resource_vtbl si_texture_vtbl = { - si_texture_destroy, /* resource_destroy */ + NULL, /* resource_destroy */ si_texture_transfer_map, /* transfer_map */ si_texture_transfer_unmap, /* transfer_unmap */ }; |