From 912ee82521ec0507a00dd108b28bf4d864ce6d95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 14 Feb 2020 17:57:01 -0500 Subject: [PATCH] gallium/util: remove unused u_surfaces.c/h Tested-by: Marge Bot Part-of: --- src/gallium/auxiliary/Makefile.sources | 2 - src/gallium/auxiliary/meson.build | 2 - src/gallium/auxiliary/util/u_surfaces.c | 123 ------------------------ src/gallium/auxiliary/util/u_surfaces.h | 101 ------------------- 4 files changed, 228 deletions(-) delete mode 100644 src/gallium/auxiliary/util/u_surfaces.c delete mode 100644 src/gallium/auxiliary/util/u_surfaces.h diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 2cba524f2bc..2fc8ffbe40d 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -295,8 +295,6 @@ C_SOURCES := \ util/u_suballoc.h \ util/u_surface.c \ util/u_surface.h \ - util/u_surfaces.c \ - util/u_surfaces.h \ util/u_tests.c \ util/u_tests.h \ util/u_texture.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index c36f3083739..f623af9ed69 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -315,8 +315,6 @@ files_libgallium = files( 'util/u_suballoc.h', 'util/u_surface.c', 'util/u_surface.h', - 'util/u_surfaces.c', - 'util/u_surfaces.h', 'util/u_tests.c', 'util/u_tests.h', 'util/u_texture.c', diff --git a/src/gallium/auxiliary/util/u_surfaces.c b/src/gallium/auxiliary/util/u_surfaces.c deleted file mode 100644 index 1f9c5a6dd5c..00000000000 --- a/src/gallium/auxiliary/util/u_surfaces.c +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "u_surfaces.h" -#include "util/u_hash_table.h" -#include "util/u_inlines.h" -#include "util/u_memory.h" - -boolean -util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, - struct pipe_context *ctx, struct pipe_resource *pt, - unsigned level, unsigned layer, - struct pipe_surface **res) -{ - struct pipe_surface *ps; - - if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) - { /* or 2D array */ - if (!us->u.hash.end) - cso_hash_init(&us->u.hash); - - ps = cso_hash_iter_data(cso_hash_find(&us->u.hash, (layer << 8) | level)); - } - else - { - if(!us->u.array) - us->u.array = CALLOC(pt->last_level + 1, sizeof(struct pipe_surface *)); - ps = us->u.array[level]; - } - - if(ps && ps->context == ctx) - { - p_atomic_inc(&ps->reference.count); - *res = ps; - return FALSE; - } - - ps = (struct pipe_surface *)CALLOC(1, surface_struct_size); - if (!ps) - { - *res = NULL; - return FALSE; - } - - pipe_surface_init(ctx, ps, pt, level, layer); - - if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) - cso_hash_insert(&us->u.hash, (layer << 8) | level, ps); - else - us->u.array[level] = ps; - - *res = ps; - return TRUE; -} - -void -util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps) -{ - struct pipe_resource *pt = ps->texture; - if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) - { /* or 2D array */ - cso_hash_erase(&us->u.hash, cso_hash_find(&us->u.hash, (ps->u.tex.first_layer << 8) | ps->u.tex.level)); - } - else - us->u.array[ps->u.tex.level] = 0; -} - -void -util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void (*destroy_surface) (struct pipe_surface *)) -{ - if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) - { /* or 2D array */ - if (&us->u.hash) - { - struct cso_hash_iter iter; - iter = cso_hash_first_node(&us->u.hash); - while (!cso_hash_iter_is_null(iter)) { - destroy_surface(cso_hash_iter_data(iter)); - iter = cso_hash_iter_next(iter); - } - - cso_hash_deinit(&us->u.hash); - } - } - else - { - if(us->u.array) - { - unsigned i; - for(i = 0; i <= pt->last_level; ++i) - { - struct pipe_surface *ps = us->u.array[i]; - if (ps) - destroy_surface(ps); - } - FREE(us->u.array); - us->u.array = NULL; - } - } -} diff --git a/src/gallium/auxiliary/util/u_surfaces.h b/src/gallium/auxiliary/util/u_surfaces.h deleted file mode 100644 index e34f7c75d07..00000000000 --- a/src/gallium/auxiliary/util/u_surfaces.h +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************** - * - * Copyright 2010 Luca Barbieri - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef U_SURFACES_H_ -#define U_SURFACES_H_ - -#include "pipe/p_compiler.h" -#include "pipe/p_state.h" -#include "util/u_atomic.h" -#include "cso_cache/cso_hash.h" - -struct util_surfaces -{ - union - { - struct cso_hash hash; - struct pipe_surface **array; - void* pv; - } u; -}; - -/* Return value indicates if the pipe surface result is new */ -boolean -util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, - struct pipe_context *ctx, struct pipe_resource *pt, - unsigned level, unsigned layer, - struct pipe_surface **res); - -/* fast inline path for the very common case */ -static inline boolean -util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, - struct pipe_context *ctx, struct pipe_resource *pt, - unsigned level, unsigned layer, - struct pipe_surface **res) -{ - if(likely((pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT) && us->u.array)) - { - struct pipe_surface *ps = us->u.array[level]; - if(ps && ps->context == ctx) - { - p_atomic_inc(&ps->reference.count); - *res = ps; - return FALSE; - } - } - - return util_surfaces_do_get(us, surface_struct_size, ctx, pt, level, layer, res); -} - -static inline struct pipe_surface * -util_surfaces_peek(struct util_surfaces *us, struct pipe_resource *pt, unsigned level, unsigned layer) -{ - if(!us->u.pv) - return 0; - - if(unlikely(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE)) - return cso_hash_iter_data(cso_hash_find(&us->u.hash, (layer << 8) | level)); - else - return us->u.array[level]; -} - -void util_surfaces_do_detach(struct util_surfaces *us, struct pipe_surface *ps); - -static inline void -util_surfaces_detach(struct util_surfaces *us, struct pipe_surface *ps) -{ - if(likely(ps->texture->target == PIPE_TEXTURE_2D || ps->texture->target == PIPE_TEXTURE_RECT)) - { - us->u.array[ps->u.tex.level] = 0; - return; - } - - util_surfaces_do_detach(us, ps); -} - -void util_surfaces_destroy(struct util_surfaces *us, struct pipe_resource *pt, void (*destroy_surface) (struct pipe_surface *)); - -#endif -- 2.30.2