diff options
author | Alyssa Rosenzweig <alyssa@collabora.com> | 2023-02-10 21:22:49 -0500 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-03-23 23:53:46 +0000 |
commit | ffb9919c2fefe32f72a0889a45a707c86ced6a61 (patch) | |
tree | 86d524641098cca9cd717e553ea0cfece4b19775 /src/panfrost/util | |
parent | 455a76f10a0c04a3262fa78f7b02f19dc39bd661 (diff) |
panfrost: Lower sysvals in GL
Drop the backend compiler sysval handling in favour of the pass in the GL
driver, bringing us into compliance with Ekstrand's rule.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20906>
Diffstat (limited to 'src/panfrost/util')
-rw-r--r-- | src/panfrost/util/meson.build | 1 | ||||
-rw-r--r-- | src/panfrost/util/pan_ir.h | 11 | ||||
-rw-r--r-- | src/panfrost/util/pan_sysval.c | 203 |
3 files changed, 0 insertions, 215 deletions
diff --git a/src/panfrost/util/meson.build b/src/panfrost/util/meson.build index 1112ae56e39..791923f91df 100644 --- a/src/panfrost/util/meson.build +++ b/src/panfrost/util/meson.build @@ -34,7 +34,6 @@ libpanfrost_util_files = files( 'pan_lower_writeout.c', 'pan_lower_xfb.c', 'pan_lower_64bit_intrin.c', - 'pan_sysval.c', ) libpanfrost_util = static_library( diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index 3731b1b7ee4..f1e30d0281b 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -160,15 +160,6 @@ struct panfrost_ubo_push { unsigned pan_lookup_pushed_ubo(struct panfrost_ubo_push *push, unsigned ubo, unsigned offs); -struct hash_table_u64 * -panfrost_init_sysvals(struct panfrost_sysvals *sysvals, - struct panfrost_sysvals *fixed_sysvals, void *memctx); - -unsigned pan_lookup_sysval(struct hash_table_u64 *sysval_to_id, - struct panfrost_sysvals *sysvals, int sysval); - -int panfrost_sysval_for_instr(nir_instr *instr, nir_dest *dest); - struct panfrost_compile_inputs { struct util_debug_callback *debug; @@ -178,8 +169,6 @@ struct panfrost_compile_inputs { unsigned nr_samples; uint64_t bifrost_blend_desc; } blend; - int fixed_sysval_ubo; - struct panfrost_sysvals *fixed_sysval_layout; bool no_idvs; bool no_ubo_to_push; diff --git a/src/panfrost/util/pan_sysval.c b/src/panfrost/util/pan_sysval.c deleted file mode 100644 index 7a958753d9b..00000000000 --- a/src/panfrost/util/pan_sysval.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2020 Collabora Ltd. - * - * 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 AUTHORS OR COPYRIGHT HOLDERS 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. - * - * Authors (Collabora): - * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> - */ - -#include "compiler/nir/nir_builder.h" -#include "pan_ir.h" - -/* TODO: ssbo_size */ -static int -panfrost_sysval_for_ssbo(nir_intrinsic_instr *instr) -{ - nir_src index = instr->src[0]; - assert(nir_src_is_const(index)); - uint32_t uindex = nir_src_as_uint(index); - - return PAN_SYSVAL(SSBO, uindex); -} - -static int -panfrost_sysval_for_sampler(nir_intrinsic_instr *instr) -{ - /* TODO: indirect samplers !!! */ - nir_src index = instr->src[0]; - assert(nir_src_is_const(index)); - uint32_t uindex = nir_src_as_uint(index); - - return PAN_SYSVAL(SAMPLER, uindex); -} - -static int -panfrost_sysval_for_image_size(nir_intrinsic_instr *instr) -{ - nir_src index = instr->src[0]; - assert(nir_src_is_const(index)); - - bool is_array = nir_intrinsic_image_array(instr); - uint32_t uindex = nir_src_as_uint(index); - unsigned dim = nir_intrinsic_dest_components(instr) - is_array; - - return PAN_SYSVAL(IMAGE_SIZE, PAN_TXS_SYSVAL_ID(uindex, dim, is_array)); -} - -static int -panfrost_sysval_for_rt_conversion(nir_intrinsic_instr *instr) -{ - unsigned size = nir_alu_type_get_type_size(nir_intrinsic_src_type(instr)); - unsigned rt = nir_intrinsic_base(instr); - - return PAN_SYSVAL(RT_CONVERSION, rt | (size << 4)); -} - -static unsigned -panfrost_nir_sysval_for_intrinsic(nir_intrinsic_instr *instr) -{ - switch (instr->intrinsic) { - case nir_intrinsic_load_viewport_scale: - return PAN_SYSVAL_VIEWPORT_SCALE; - case nir_intrinsic_load_viewport_offset: - return PAN_SYSVAL_VIEWPORT_OFFSET; - case nir_intrinsic_load_num_workgroups: - return PAN_SYSVAL_NUM_WORK_GROUPS; - case nir_intrinsic_load_workgroup_size: - return PAN_SYSVAL_LOCAL_GROUP_SIZE; - case nir_intrinsic_load_work_dim: - return PAN_SYSVAL_WORK_DIM; - case nir_intrinsic_load_sample_positions_pan: - return PAN_SYSVAL_SAMPLE_POSITIONS; - case nir_intrinsic_load_multisampled_pan: - return PAN_SYSVAL_MULTISAMPLED; - case nir_intrinsic_load_first_vertex: - case nir_intrinsic_load_base_vertex: - case nir_intrinsic_load_base_instance: - return PAN_SYSVAL_VERTEX_INSTANCE_OFFSETS; - case nir_intrinsic_load_draw_id: - return PAN_SYSVAL_DRAWID; - case nir_intrinsic_load_ssbo_address: - case nir_intrinsic_get_ssbo_size: - return panfrost_sysval_for_ssbo(instr); - case nir_intrinsic_load_xfb_address: - return PAN_SYSVAL(XFB, nir_intrinsic_base(instr)); - case nir_intrinsic_load_num_vertices: - return PAN_SYSVAL_NUM_VERTICES; - case nir_intrinsic_load_sampler_lod_parameters_pan: - return panfrost_sysval_for_sampler(instr); - case nir_intrinsic_image_size: - return panfrost_sysval_for_image_size(instr); - case nir_intrinsic_load_blend_const_color_rgba: - return PAN_SYSVAL_BLEND_CONSTANTS; - case nir_intrinsic_load_rt_conversion_pan: - return panfrost_sysval_for_rt_conversion(instr); - default: - return ~0; - } -} - -int -panfrost_sysval_for_instr(nir_instr *instr, nir_dest *dest) -{ - nir_intrinsic_instr *intr; - nir_dest *dst = NULL; - nir_tex_instr *tex; - unsigned sysval = ~0; - - switch (instr->type) { - case nir_instr_type_intrinsic: - intr = nir_instr_as_intrinsic(instr); - sysval = panfrost_nir_sysval_for_intrinsic(intr); - dst = &intr->dest; - break; - case nir_instr_type_tex: - tex = nir_instr_as_tex(instr); - if (tex->op != nir_texop_txs) - break; - - sysval = PAN_SYSVAL(TEXTURE_SIZE, - PAN_TXS_SYSVAL_ID(tex->texture_index, - nir_tex_instr_dest_size(tex) - - (tex->is_array ? 1 : 0), - tex->is_array)); - dst = &tex->dest; - break; - default: - break; - } - - if (dest && dst) - *dest = *dst; - - return sysval; -} - -static unsigned -pan_add_sysval(struct hash_table_u64 *sysval_to_id, - struct panfrost_sysvals *sysvals, int sysval, unsigned id) -{ - assert(id < MAX_SYSVAL_COUNT); - _mesa_hash_table_u64_insert(sysval_to_id, sysval, - (void *)((uintptr_t)id + 1)); - sysvals->sysvals[id] = sysval; - return id; -} - -unsigned -pan_lookup_sysval(struct hash_table_u64 *sysval_to_id, - struct panfrost_sysvals *sysvals, int sysval) -{ - /* Try to lookup */ - - void *cached = _mesa_hash_table_u64_search(sysval_to_id, sysval); - - if (cached) { - unsigned id = ((uintptr_t)cached) - 1; - assert(id < MAX_SYSVAL_COUNT); - assert(sysvals->sysvals[id] == sysval); - return id; - } - - /* Else assign */ - return pan_add_sysval(sysval_to_id, sysvals, sysval, - sysvals->sysval_count++); -} - -struct hash_table_u64 * -panfrost_init_sysvals(struct panfrost_sysvals *sysvals, - struct panfrost_sysvals *fixed_sysvals, void *memctx) -{ - memset(sysvals, 0, sizeof(*sysvals)); - struct hash_table_u64 *sysval_to_id = _mesa_hash_table_u64_create(memctx); - - if (fixed_sysvals) { - for (unsigned i = 0; i < fixed_sysvals->sysval_count; i++) { - if (!fixed_sysvals->sysvals[i]) - continue; - - pan_add_sysval(sysval_to_id, sysvals, fixed_sysvals->sysvals[i], i); - } - sysvals->sysval_count = fixed_sysvals->sysval_count; - } - - return sysval_to_id; -} |