diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-10 14:50:48 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-11 14:27:25 +0000 |
commit | 507e297431b9e55ddf3bea4a4039cec4824596a1 (patch) | |
tree | 5c5a02777f111d45cb315ecf2de3009810cbae4c /src/gallium/drivers/panfrost | |
parent | cd403a931fb953249ab8b046ecd614287afc2d2d (diff) |
panfrost: Don't lie about Z/S formats
Only Z24S8 is properly supported right now, so let's be careful. Fixes a
number of issues relating to improper Z/S handling. The most obvious is
depth buffers with incorrect strides, which manifests in truly bizarre
ways and can happen commonly with FBOs.
Fixes WebGL (Aquarium runs, etc).
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r-- | src/gallium/drivers/panfrost/ci/expected-failures.txt | 5 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_afbc.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_mfbd.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_screen.c | 20 |
4 files changed, 34 insertions, 6 deletions
diff --git a/src/gallium/drivers/panfrost/ci/expected-failures.txt b/src/gallium/drivers/panfrost/ci/expected-failures.txt index e76ef331a13..dfc08861675 100644 --- a/src/gallium/drivers/panfrost/ci/expected-failures.txt +++ b/src/gallium/drivers/panfrost/ci/expected-failures.txt @@ -27,11 +27,8 @@ dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgb_depth_com dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgb_stencil_index8 dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgba_depth_component16 dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgba_stencil_index8 -dEQP-GLES2.functional.fbo.render.resize.rbo_rgb565_depth_component16 dEQP-GLES2.functional.fbo.render.resize.rbo_rgb565_stencil_index8 -dEQP-GLES2.functional.fbo.render.resize.rbo_rgb5_a1_depth_component16 dEQP-GLES2.functional.fbo.render.resize.rbo_rgb5_a1_stencil_index8 -dEQP-GLES2.functional.fbo.render.resize.rbo_rgba4_depth_component16 dEQP-GLES2.functional.fbo.render.resize.rbo_rgba4_stencil_index8 dEQP-GLES2.functional.fbo.render.resize.tex2d_rgb_depth_component16 dEQP-GLES2.functional.fbo.render.resize.tex2d_rgb_stencil_index8 @@ -248,10 +245,8 @@ dEQP-GLES2.functional.fragment_ops.random.97 dEQP-GLES2.functional.fragment_ops.random.98 dEQP-GLES2.functional.fragment_ops.random.99 dEQP-GLES2.functional.polygon_offset.fixed16_displacement_with_units -dEQP-GLES2.functional.polygon_offset.fixed16_enable dEQP-GLES2.functional.polygon_offset.fixed16_render_with_factor dEQP-GLES2.functional.polygon_offset.fixed16_render_with_units -dEQP-GLES2.functional.polygon_offset.fixed16_result_depth_clamp dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_w dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_fragment dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_vertex diff --git a/src/gallium/drivers/panfrost/pan_afbc.c b/src/gallium/drivers/panfrost/pan_afbc.c index 298c04be1c4..23e1ec921dd 100644 --- a/src/gallium/drivers/panfrost/pan_afbc.c +++ b/src/gallium/drivers/panfrost/pan_afbc.c @@ -93,7 +93,12 @@ panfrost_format_supports_afbc(enum pipe_format format) if (util_format_is_rgba8_variant(desc)) return true; - if (format == PIPE_FORMAT_Z32_UNORM) + /* Z32/Z16/S8 are all compressible as well, but they are implemented as + * Z24S8 with wasted bits. So Z24S8 is the only format we actually need + * to handle compressed, and we can make the state tracker deal with + * the rest. */ + + if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT) return true; /* TODO: AFBC of other formats */ diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 11cd2aca5a6..463e9190400 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -254,6 +254,7 @@ panfrost_mfbd_set_zsbuf( struct pipe_surface *surf) { struct panfrost_resource *rsrc = pan_resource(surf->texture); + enum pipe_format format = surf->format; unsigned level = surf->u.tex.level; assert(surf->u.tex.first_layer == 0); @@ -261,6 +262,10 @@ panfrost_mfbd_set_zsbuf( unsigned offset = rsrc->slices[level].offset; if (rsrc->layout == PAN_AFBC) { + /* The only Z/S format we can compress is Z24S8 or variants + * thereof (handled by the state tracker) */ + assert(format == PIPE_FORMAT_Z24_UNORM_S8_UINT); + mali_ptr base = rsrc->bo->gpu + offset; unsigned header_size = rsrc->slices[level].header_size; @@ -280,6 +285,9 @@ panfrost_mfbd_set_zsbuf( fbx->ds_afbc.zero1 = 0x10009; fbx->ds_afbc.padding = 0x1000; } else if (rsrc->layout == PAN_LINEAR) { + /* TODO: Z32F(S8) support, which is always linear */ + + assert(format == PIPE_FORMAT_Z24_UNORM_S8_UINT); int stride = rsrc->slices[level].stride; fb->mfbd_flags |= MALI_MFBD_EXTRA; diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index f8a637be850..cfcee5743b9 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -410,6 +410,26 @@ panfrost_is_format_supported( struct pipe_screen *screen, return FALSE; } + /* Internally, formats that are depth/stencil renderable are limited. + * + * In particular: Z16, Z24, Z24S8, S8 are all identical from the GPU + * rendering perspective. That is, we render to Z24S8 (which we can + * AFBC compress), ignore the different when texturing (who cares?), + * and then in the off-chance there's a CPU read we blit back to + * staging. + * + * ...alternatively, we can make the state tracker deal with that. */ + + if (bind & PIPE_BIND_DEPTH_STENCIL) { + switch (format) { + case PIPE_FORMAT_Z24_UNORM_S8_UINT: + return true; + + default: + return false; + } + } + return TRUE; } |