From 584e996ddd770c06176e6335950a10ddc3081c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 25 Apr 2022 03:52:59 -0400 Subject: [PATCH] radeonsi: remove si_create_sampler_view_custom and related code This was used for compressed and subsampled gfx copies. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_descriptors.c | 2 +- src/gallium/drivers/radeonsi/si_pipe.h | 1 - src/gallium/drivers/radeonsi/si_state.c | 45 +++---------------- src/gallium/drivers/radeonsi/si_state.h | 5 --- 4 files changed, 8 insertions(+), 45 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index c0ee237692a..6dba441cb87 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -470,7 +470,7 @@ static void si_set_sampler_view_desc(struct si_context *sctx, struct si_sampler_ bool is_separate_stencil = tex->db_compatible && sview->is_stencil_sampler; memcpy(desc, sview->state, 8 * 4); - si_set_mutable_tex_desc_fields(sctx->screen, tex, sview->base_level_info, sview->base_level, + si_set_mutable_tex_desc_fields(sctx->screen, tex, sview->base_level_info, 0, sview->base.u.tex.first_level, sview->block_width, is_separate_stencil, 0, desc); diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 5bdab0cfe11..e3891105f1e 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -700,7 +700,6 @@ struct si_sampler_view { uint32_t state[8]; uint32_t fmask_state[8]; const struct legacy_surf_level *base_level_info; - ubyte base_level; ubyte block_width; bool is_stencil_sampler; bool dcc_incompatible; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index bdbda1a9af8..6e77da76c8b 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -4365,22 +4365,15 @@ static void si_make_texture_descriptor(struct si_screen *screen, struct si_textu * @param ctx context * @param texture texture * @param state sampler view template - * @param width0 width0 override (for compressed textures as int) - * @param height0 height0 override (for compressed textures as int) - * @param force_level set the base address to the level (for compressed textures) */ -struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx, +static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx, struct pipe_resource *texture, - const struct pipe_sampler_view *state, - unsigned width0, unsigned height0, - unsigned force_level) + const struct pipe_sampler_view *state) { struct si_context *sctx = (struct si_context *)ctx; struct si_sampler_view *view = CALLOC_STRUCT_CL(si_sampler_view); struct si_texture *tex = (struct si_texture *)texture; - unsigned base_level, first_level, last_level; unsigned char state_swizzle[4]; - unsigned height, depth, width; unsigned last_layer = state->u.tex.last_layer; enum pipe_format pipe_format; const struct legacy_surf_level *surflevel; @@ -4413,23 +4406,6 @@ struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx state_swizzle[2] = state->swizzle_b; state_swizzle[3] = state->swizzle_a; - base_level = 0; - first_level = state->u.tex.first_level; - last_level = state->u.tex.last_level; - width = width0; - height = height0; - depth = texture->depth0; - - if (sctx->chip_class <= GFX8 && force_level) { - assert(force_level == first_level && force_level == last_level); - base_level = force_level; - first_level = 0; - last_level = 0; - width = u_minify(width, force_level); - height = u_minify(height, force_level); - depth = u_minify(depth, force_level); - } - /* This is not needed if gallium frontends set last_layer correctly. */ if (state->target == PIPE_TEXTURE_1D || state->target == PIPE_TEXTURE_2D || state->target == PIPE_TEXTURE_RECT || state->target == PIPE_TEXTURE_CUBE) @@ -4488,23 +4464,16 @@ struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx vi_dcc_formats_are_incompatible(texture, state->u.tex.first_level, state->format); sctx->screen->make_texture_descriptor( - sctx->screen, tex, true, state->target, pipe_format, state_swizzle, first_level, last_level, - state->u.tex.first_layer, last_layer, width, height, depth, view->state, view->fmask_state); + sctx->screen, tex, true, state->target, pipe_format, state_swizzle, + state->u.tex.first_level, state->u.tex.last_level, + state->u.tex.first_layer, last_layer, texture->width0, texture->height0, texture->depth0, + view->state, view->fmask_state); - view->base_level_info = &surflevel[base_level]; - view->base_level = base_level; + view->base_level_info = &surflevel[0]; view->block_width = util_format_get_blockwidth(pipe_format); return &view->base; } -static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx, - struct pipe_resource *texture, - const struct pipe_sampler_view *state) -{ - return si_create_sampler_view_custom(ctx, texture, state, texture ? texture->width0 : 0, - texture ? texture->height0 : 0, 0); -} - static void si_sampler_view_destroy(struct pipe_context *ctx, struct pipe_sampler_view *state) { struct si_sampler_view *view = (struct si_sampler_view *)state; diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 4cf01badc14..8888ca7e720 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -531,11 +531,6 @@ void si_init_cs_preamble_state(struct si_context *sctx, bool uses_reg_shadowing) void si_make_buffer_descriptor(struct si_screen *screen, struct si_resource *buf, enum pipe_format format, unsigned offset, unsigned size, uint32_t *state); -struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx, - struct pipe_resource *texture, - const struct pipe_sampler_view *state, - unsigned width0, unsigned height0, - unsigned force_level); void si_set_sampler_depth_decompress_mask(struct si_context *sctx, struct si_texture *tex); void si_update_fb_dirtiness_after_rendering(struct si_context *sctx); void si_mark_display_dcc_dirty(struct si_context *sctx, struct si_texture *tex);