r600: fix spec ext_packed_depth_stencil getteximage

This very test was working until the commit 4da147a02b
("mesa: remove fallback for GL_DEPTH_STENCIL"). Indeed this
commit lets the driver handles this path and this was
failing on evergreen r600.

The test was processed through r600_blit() which loads the
fragment shader util_make_fs_blit_zs(). This fragment shader
loads two textures the stencil and depth. The texture depth
was processed properly but the other texture was generating
incorrect values. This issue, which seems to be related to
the hardware configuration, disappears when the underlying
surface is allocated using a width multiple of 32.

This change was tested on cayman and palm with the normal test:
"piglit/bin/ext_packed_depth_stencil-getteximage -auto -fb" and
the test was modified to test all the relevant width and height
values. The gpu rv770 was not affected by this issue. Here is
the result:
spec/ext_packed_depth_stencil/getteximage: fail pass

Cc: mesa-stable
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31757>
This commit is contained in:
Patrick Lerda 2024-10-19 03:39:34 +02:00 committed by Marge Bot
parent e98759c7f4
commit d19e2597ce

View file

@ -191,10 +191,17 @@ static int r600_init_surface(struct r600_common_screen *rscreen,
bool is_depth, is_stencil;
int r;
unsigned i, bpe, flags = 0;
struct pipe_resource ptmp;
is_depth = util_format_has_depth(desc);
is_stencil = util_format_has_stencil(desc);
if (unlikely(rscreen->gfx_level >= EVERGREEN && ptex->format == PIPE_FORMAT_S8_UINT_Z24_UNORM && (ptex->width0 & 31))) {
memcpy(&ptmp, ptex, sizeof(ptmp));
ptmp.width0 = (ptex->width0 + 31) & ~31;
ptex = &ptmp;
}
if (rscreen->gfx_level >= EVERGREEN && !is_flushed_depth &&
ptex->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) {
bpe = 4; /* stencil is allocated separately on evergreen */