From 7d234da6ee3693286c2ad796c5c4c24856a86573 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Apr 2021 15:09:18 -0700 Subject: [PATCH] freedreno: Fix YUV sampler regression. We have to keep sampler uniforms around for later YUV lowering, and we only need to remove uniforms that take up storage space. Code comes from radeonsi. Closes: #4644. Fixes: de17b4aab568 ("freedreno: Remove uniform variables after finalizing NIR.") Part-of: --- src/freedreno/ir3/ir3_nir.c | 10 ++++++++++ .../freedreno/ci/piglit-freedreno-a530-fails.txt | 3 --- .../freedreno/ci/piglit-freedreno-a630-fails.txt | 7 ------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index e3bf7c9b79c..284ec295025 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -337,7 +337,17 @@ ir3_finalize_nir(struct ir3_compiler *compiler, nir_shader *s) debug_printf("----------------------\n"); } + /* st_program.c's parameter list optimization requires that future nir + * variants don't reallocate the uniform storage, so we have to remove + * uniforms that occupy storage. But we don't want to remove samplers, + * because they're needed for YUV variant lowering. + */ nir_foreach_uniform_variable_safe(var, s) { + if (var->data.mode == nir_var_uniform && + (glsl_type_get_image_count(var->type) || + glsl_type_get_sampler_count(var->type))) + continue; + exec_node_remove(&var->node); } nir_validate_shader(s, "after uniform var removal"); diff --git a/src/gallium/drivers/freedreno/ci/piglit-freedreno-a530-fails.txt b/src/gallium/drivers/freedreno/ci/piglit-freedreno-a530-fails.txt index 69239996ffc..d12bd25ce2a 100644 --- a/src/gallium/drivers/freedreno/ci/piglit-freedreno-a530-fails.txt +++ b/src/gallium/drivers/freedreno/ci/piglit-freedreno-a530-fails.txt @@ -225,15 +225,12 @@ spec@ext_framebuffer_object@getteximage-formats init-by-clear-and-render,Fail spec@ext_framebuffer_object@getteximage-formats init-by-rendering,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_ayuv,Fail -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_nv12,Crash spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p010,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p012,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p016,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_uyvy,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_xyuv,Fail -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yuv420,Crash spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yuyv,Fail -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Crash spec@ext_packed_depth_stencil@fbo-clear-formats,Fail spec@ext_packed_depth_stencil@fbo-clear-formats stencil,Fail spec@ext_packed_depth_stencil@fbo-depth-gl_depth24_stencil8-blit,Fail diff --git a/src/gallium/drivers/freedreno/ci/piglit-freedreno-a630-fails.txt b/src/gallium/drivers/freedreno/ci/piglit-freedreno-a630-fails.txt index 4739beb25a8..5e3ab9c62ff 100644 --- a/src/gallium/drivers/freedreno/ci/piglit-freedreno-a630-fails.txt +++ b/src/gallium/drivers/freedreno/ci/piglit-freedreno-a630-fails.txt @@ -273,14 +273,7 @@ spec@ext_framebuffer_object@getteximage-formats init-by-clear-and-render,Fail spec@ext_framebuffer_object@getteximage-formats init-by-rendering,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export,Fail spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_ayuv,Fail -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p010,Crash -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p012,Crash -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_p016,Crash -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_uyvy,Crash spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_xyuv,Fail -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yuv420,Crash -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yuyv,Crash -spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Crash spec@ext_packed_depth_stencil@texwrap formats bordercolor,Fail spec@ext_packed_depth_stencil@texwrap formats bordercolor-swizzled,Fail spec@ext_packed_float@query-rgba-signed-components,Fail