From 4117f08226fac9a95de88b62d18fc0e9d9b57abe Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 27 Nov 2020 21:03:36 +0100 Subject: [PATCH] panfrost: Fix several depth/stencil format mappings Stencil should always be loaded in component Y, even when the buffer only contains stencil values. Patch the blit shaders accordingly, and fix some format definitions. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- .gitlab-ci/deqp-panfrost-t860-fails.txt | 18 ------------------ .gitlab-ci/traces-panfrost.yml | 2 +- src/panfrost/lib/pan_blit.c | 8 +++++--- src/panfrost/lib/pan_format.c | 14 ++++++++------ 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci/deqp-panfrost-t860-fails.txt b/.gitlab-ci/deqp-panfrost-t860-fails.txt index 462f206643d..cd500e31cee 100644 --- a/.gitlab-ci/deqp-panfrost-t860-fails.txt +++ b/.gitlab-ci/deqp-panfrost-t860-fails.txt @@ -12,24 +12,6 @@ dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_x,Fa dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_y,Fail dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_x,Fail dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_y,Fail -dEQP-GLES3.functional.fbo.invalidate.sub.unbind_blit_msaa_color,Fail -dEQP-GLES3.functional.fbo.invalidate.sub.unbind_blit_msaa_depth,Fail -dEQP-GLES3.functional.fbo.invalidate.sub.unbind_blit_msaa_stencil,Fail -dEQP-GLES3.functional.fbo.invalidate.whole.unbind_blit_msaa_color,Fail -dEQP-GLES3.functional.fbo.invalidate.whole.unbind_blit_msaa_depth,Fail -dEQP-GLES3.functional.fbo.invalidate.whole.unbind_blit_msaa_stencil,Fail -dEQP-GLES3.functional.fbo.msaa.2_samples.depth24_stencil8,Fail -dEQP-GLES3.functional.fbo.msaa.2_samples.depth32f_stencil8,Fail -dEQP-GLES3.functional.fbo.msaa.2_samples.depth_component16,Fail -dEQP-GLES3.functional.fbo.msaa.2_samples.depth_component24,Fail -dEQP-GLES3.functional.fbo.msaa.2_samples.depth_component32f,Fail -dEQP-GLES3.functional.fbo.msaa.2_samples.stencil_index8,Fail -dEQP-GLES3.functional.fbo.msaa.4_samples.depth24_stencil8,Fail -dEQP-GLES3.functional.fbo.msaa.4_samples.depth32f_stencil8,Fail -dEQP-GLES3.functional.fbo.msaa.4_samples.depth_component16,Fail -dEQP-GLES3.functional.fbo.msaa.4_samples.depth_component24,Fail -dEQP-GLES3.functional.fbo.msaa.4_samples.depth_component32f,Fail -dEQP-GLES3.functional.fbo.msaa.4_samples.stencil_index8,Fail dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_dynamic_loop_read_fragment,Crash dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_dynamic_loop_read_vertex,Crash dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_dynamic_read_fragment,Crash diff --git a/.gitlab-ci/traces-panfrost.yml b/.gitlab-ci/traces-panfrost.yml index 2e2e84f6676..156602d0d8f 100644 --- a/.gitlab-ci/traces-panfrost.yml +++ b/.gitlab-ci/traces-panfrost.yml @@ -51,7 +51,7 @@ traces: - path: humus/Portals.trace expectations: - device: gl-panfrost-t860 - checksum: 5415bbf2a69b605bb1052a0e0b0f7040 + checksum: f83da726bff354684a576effa74ef681 - device: gl-panfrost-t760 checksum: a41f53e9318cbd32c27b48d304df1ea6 - path: 0ad/0ad.trace diff --git a/src/panfrost/lib/pan_blit.c b/src/panfrost/lib/pan_blit.c index d449f1b0fa2..df4b4bc348c 100644 --- a/src/panfrost/lib/pan_blit.c +++ b/src/panfrost/lib/pan_blit.c @@ -96,10 +96,12 @@ panfrost_build_blit_shader(struct panfrost_device *dev, nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, NULL); nir_builder_instr_insert(b, &tex->instr); - if (is_colour) + if (is_colour) { nir_store_var(b, c_out, &tex->dest.ssa, 0xFF); - else - nir_store_var(b, c_out, nir_channel(b, &tex->dest.ssa, 0), 0xFF); + } else { + unsigned c = loc == FRAG_RESULT_STENCIL ? 1 : 0; + nir_store_var(b, c_out, nir_channel(b, &tex->dest.ssa, c), 0xFF); + } struct panfrost_compile_inputs inputs = { .gpu_id = dev->gpu_id, diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c index 3edbec31cf0..7a4e1423b7d 100644 --- a/src/panfrost/lib/pan_format.c +++ b/src/panfrost/lib/pan_format.c @@ -96,6 +96,8 @@ panfrost_blend_format(enum pipe_format format) #define FLAGS__T_Z (_T | _Z) #define V6_000R PAN_V6_SWIZZLE(0, 0, 0, R) +#define V6_0R00 PAN_V6_SWIZZLE(0, R, 0, 0) +#define V6_0A00 PAN_V6_SWIZZLE(0, A, 0, 0) #define V6_A001 PAN_V6_SWIZZLE(A, 0, 0, 1) #define V6_ABG1 PAN_V6_SWIZZLE(A, B, G, 1) #define V6_ABGR PAN_V6_SWIZZLE(A, B, G, R) @@ -241,9 +243,9 @@ const struct panfrost_format panfrost_pipe_format_v6[PIPE_FORMAT_COUNT] = { PAN_V6(Z24X8_UNORM, Z24X8_UNORM, R000, L, _T_Z), PAN_V6(Z32_FLOAT, R32F, R000, L, _T_Z), PAN_V6(Z32_FLOAT_S8X24_UINT, R32F, R000, L, _T_Z), - PAN_V6(X32_S8X24_UINT, R32UI, R001, L, _T__), - PAN_V6(X24S8_UINT, RGBA8UI, A001, L, _T_Z), - PAN_V6(S8_UINT, R8UI, R001, L, _T__), + PAN_V6(X32_S8X24_UINT, R32UI, 0R00, L, _T__), + PAN_V6(X24S8_UINT, RGBA8UI, 0A00, L, _T_Z), + PAN_V6(S8_UINT, R8UI, 0R00, L, _T__), PAN_V6(R32_FIXED, R32_FIXED, R001, L, V___), PAN_V6(R32G32_FIXED, RG32_FIXED, RG01, L, V___), PAN_V6(R32G32B32_FIXED, RGB32_FIXED, RGB1, L, V___), @@ -491,9 +493,9 @@ const struct panfrost_format panfrost_pipe_format_v7[PIPE_FORMAT_COUNT] = { PAN_V7(Z24X8_UNORM, Z24X8_UNORM, RGBA, L, _T_Z), PAN_V7(Z32_FLOAT, R32F, RGBA, L, _T_Z), PAN_V7(Z32_FLOAT_S8X24_UINT, R32F, RGBA, L, _T_Z), - PAN_V7(X32_S8X24_UINT, S8X24, GRBA, L, _T__), - PAN_V7(X24S8_UINT, TILEBUFFER_NATIVE /* XXX: Deduplicate enum */, GRBA, L, _T_Z), - PAN_V7(S8_UINT, S8, GRBA, L, _T__), + PAN_V7(X32_S8X24_UINT, S8X24, RGBA, L, _T__), + PAN_V7(X24S8_UINT, TILEBUFFER_NATIVE /* XXX: Deduplicate enum */, RGBA, L, _T_Z), + PAN_V7(S8_UINT, S8, RGBA, L, _T__), PAN_V7(R32_FIXED, R32_FIXED, RGB1, L, V___), PAN_V7(R32G32_FIXED, RG32_FIXED, RGB1, L, V___), PAN_V7(R32G32B32_FIXED, RGB32_FIXED, RGB1, L, V___),