r300: fix MSAA resolve COLORPITCH tiling after pipe_surface de-pointerization

r300_simple_msaa_resolve used to patch srcsurf->pitch with the resolve
destination's tiling bits before passing the surface to the blitter.
That worked when set_framebuffer_state kept the same pipe_surface
pointer, so r300_get_nonnull_cb returned the patched object.

After the de-pointerization, r300_framebuffer_init creates a fresh
r300_surface from the pipe_surface template, discarding the pitch
modification. The hardware then uses the MSAA source tiling for
R300_RB3D_COLORPITCH0, leading to corruption.

Move the tiling override into r300_emit_fb_state and override the tiling
bits of COLORPITCH from the destination surface at emit time.

Fixes: 2eb45daa9c ("gallium: de-pointerize pipe_surface")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15303
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41092>
This commit is contained in:
Pavel Ondračka 2026-04-22 10:02:07 +02:00 committed by Marge Bot
parent af1669d9e2
commit 416da54cce
10 changed files with 17 additions and 28 deletions

View file

@ -1160,16 +1160,9 @@ spec@glsl-1.10@execution@glsl-fs-texture2d-mipmap-const-bias-01,Fail
spec@glsl-1.10@execution@glsl-fs-texture2d-mipmap-const-bias-04,Fail
spec@glsl-1.10@execution@glsl-fs-texture2d-mipmap-const-bias-05,Fail
glx@glx-copy-sub-buffer samples=2,Fail
glx@glx-copy-sub-buffer samples=4,Fail
glx@glx-copy-sub-buffer samples=6,Fail
glx@glx-make-current,Fail
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth,Fail
glx@glx-visuals-depth -pixmap,Fail
glx@glx-visuals-stencil,Fail
glx@glx-visuals-stencil -pixmap,Fail
glx@glx_arb_sync_control@waitformsc,Fail
spec@egl 1.4@largest possible eglcreatepbuffersurface and then glclear,Fail
spec@egl_mesa_configless_context@basic,Fail

View file

@ -12,5 +12,7 @@ dEQP-GLES2.functional.fragment_ops.scissor.contained_point
shaders@glsl-max-varyings
shaders@glsl-vs-point-size
spec@!opengl 1.2@tex3d-maxsize
glx@glx-buffer-age
glx@glx-multithread-clearbuffer

View file

@ -478,15 +478,10 @@ KHR-GLES2.texture_3d.filtering.sizes.63x63x63_nearest_mipmap_linear,Fail
KHR-GLES2.texture_3d.filtering.sizes.63x63x63_nearest_mipmap_nearest,Fail
# Piglit GPU tests
glx@glx-copy-sub-buffer samples=2,Fail
glx@glx-copy-sub-buffer samples=4,Fail
glx@glx-copy-sub-buffer samples=6,Fail
glx@glx-make-current,Fail
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth -pixmap,Fail
glx@glx-visuals-depth,Fail
glx@glx-visuals-stencil -pixmap,Fail
glx@glx-visuals-stencil,Fail
glx@glx_arb_sync_control@waitformsc,Fail

View file

@ -13,3 +13,5 @@ spec@!opengl 1.2@tex3d-maxsize
glx@glx-buffer-age
glx@glx-multithread-clearbuffer
glx@glx-visuals-stencil

View file

@ -1208,16 +1208,11 @@ spec@glsl-1.10@execution@glsl-fs-texture2d-mipmap-const-bias-05,Fail
shaders@glsl-max-varyings,Fail
spec@!opengl 1.2@tex3d-maxsize,Fail
glx@glx-copy-sub-buffer samples=2,Fail
glx@glx-copy-sub-buffer samples=4,Fail
glx@glx-copy-sub-buffer samples=6,Fail
glx@glx-make-current,Fail
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth,Fail
glx@glx-visuals-depth -pixmap,Fail
glx@glx-visuals-stencil,Fail
glx@glx-visuals-stencil -pixmap,Fail
glx@glx_arb_sync_control@waitformsc,Fail
spec@egl 1.4@largest possible eglcreatepbuffersurface and then glclear,Fail
spec@egl_mesa_configless_context@basic,Fail

View file

@ -10,3 +10,6 @@ spec@!opengl 1.2@tex3d-maxsize
glx@glx-buffer-age
glx@glx-multithread-clearbuffer
glx@glx-visuals-depth
glx@glx-visuals-stencil

View file

@ -711,15 +711,10 @@ spec@glsl-1.10@execution@glsl-fs-texture2d-mipmap-const-bias-01,Fail
spec@glsl-1.10@execution@glsl-fs-texture2d-mipmap-const-bias-04,Fail
spec@glsl-1.10@execution@glsl-fs-texture2d-mipmap-const-bias-05,Fail
glx@glx-copy-sub-buffer samples=2,Fail
glx@glx-copy-sub-buffer samples=4,Fail
glx@glx-copy-sub-buffer samples=6,Fail
glx@glx-make-current,Fail
glx@glx-multi-window-single-context,Fail
glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth,Fail
glx@glx-visuals-depth -pixmap,Fail
glx@glx-visuals-stencil,Fail
glx@glx-visuals-stencil -pixmap,Fail
glx@glx_arb_sync_control@waitformsc,Fail
spec@egl_mesa_configless_context@basic,Fail

View file

@ -1,2 +1,3 @@
glx@glx-buffer-age
glx@glx-multithread-clearbuffer
glx@glx-visuals-stencil

View file

@ -765,11 +765,6 @@ static void r300_simple_msaa_resolve(struct pipe_context *pipe,
surf_tmpl.last_layer = dst_layer;
dstsurf = r300_surface(r300_create_surface(pipe, dst, &surf_tmpl));
/* COLORPITCH should contain the tiling info of the resolve buffer.
* The tiling of the AA buffer isn't programmable anyway. */
srcsurf->pitch &= ~(R300_COLOR_TILE(1) | R300_COLOR_MICROTILE(3));
srcsurf->pitch |= dstsurf->pitch & (R300_COLOR_TILE(1) | R300_COLOR_MICROTILE(3));
/* Enable AA resolve. */
aa->dest = dstsurf;
r300->aa_state.size = 8;

View file

@ -416,6 +416,7 @@ void r300_emit_aa_state(struct r300_context *r300, unsigned size, void *state)
void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
{
struct pipe_framebuffer_state* fb = (struct pipe_framebuffer_state*)state;
struct r300_aa_state *aa = (struct r300_aa_state*)r300->aa_state.state;
struct r300_surface* surf;
unsigned i;
uint32_t rb3d_cctl = 0;
@ -445,7 +446,14 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
OUT_CS_REG(R300_RB3D_COLOROFFSET0 + (4 * i), surf->offset);
OUT_CS_RELOC(surf);
OUT_CS_REG(R300_RB3D_COLORPITCH0 + (4 * i), surf->pitch);
/* COLORPITCH should contain the tiling info of the resolve buffer.
* The tiling of the AA buffer isn't programmable anyway. */
uint32_t pitch = surf->pitch;
if (aa->dest) {
pitch &= ~(R300_COLOR_TILE(1) | R300_COLOR_MICROTILE(3));
pitch |= aa->dest->pitch & (R300_COLOR_TILE(1) | R300_COLOR_MICROTILE(3));
}
OUT_CS_REG(R300_RB3D_COLORPITCH0 + (4 * i), pitch);
OUT_CS_RELOC(surf);
if (r300->cmask_in_use && i == 0) {