freedreno/a6xx: Move fb_read descriptor to fd6_gmem

We already overwrote the entire descriptor in patch_fb_read_sysmem().
Doing the same in patch_fb_read_gmem() will simplify things for moving
the fb_read descriptor to the FS's bindless descriptor set.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20572>
This commit is contained in:
Rob Clark
2023-01-01 11:29:12 -08:00
committed by Marge Bot
parent 1452451185
commit 2128607014
2 changed files with 30 additions and 36 deletions

View File

@@ -53,27 +53,12 @@
static void
fd6_emit_fb_tex(struct fd_ringbuffer *state, struct fd_context *ctx) assert_dt
{
struct pipe_framebuffer_state *pfb = &ctx->batch->framebuffer;
struct pipe_surface *psurf = pfb->cbufs[0];
struct fd_resource *rsc = fd_resource(psurf->texture);
OUT_RINGP(state, 0, &ctx->batch->fb_read_patches); /* texconst0, patched in gmem emit */
OUT_RING(state, A6XX_TEX_CONST_1_WIDTH(pfb->width) |
A6XX_TEX_CONST_1_HEIGHT(pfb->height));
OUT_RING(state, 0); /* texconst2, patched in gmem emit */
OUT_RING(state, A6XX_TEX_CONST_3_ARRAY_PITCH(rsc->layout.layer_size));
OUT_RING(state, 0); /* BASE_LO, patched in gmem emit */
OUT_RING(state, 0); /* BASE_HI, patched in gmem emit */
OUT_RING(state, 0); /* texconst6 */
OUT_RING(state, 0); /* texconst7 */
OUT_RING(state, 0); /* texconst8 */
OUT_RING(state, 0); /* texconst9 */
OUT_RING(state, 0); /* texconst10 */
OUT_RING(state, 0); /* texconst11 */
OUT_RING(state, 0);
OUT_RING(state, 0);
OUT_RING(state, 0);
OUT_RING(state, 0);
/* This is patched with the appropriate descriptor for GMEM or
* sysmem rendering path in fd6_gmem
*/
OUT_RINGP(state, 0, &ctx->batch->fb_read_patches);
for (unsigned i = 1; i < FDL6_TEX_CONST_DWORDS; i++)
OUT_RING(state, 0);
}
void

View File

@@ -272,24 +272,33 @@ patch_fb_read_gmem(struct fd_batch *batch)
fdl6_format_swiz(psurf->format, false, swiz);
/* always TILE6_2 mode in GMEM, which also means no swap: */
uint32_t texconst0 = A6XX_TEX_CONST_0_FMT(fd6_texture_format(format, rsc->layout.tile_mode)) |
A6XX_TEX_CONST_0_SAMPLES(fd_msaa_samples(prsc->nr_samples)) |
A6XX_TEX_CONST_0_SWAP(WZYX) |
A6XX_TEX_CONST_0_TILE_MODE(TILE6_2) |
COND(util_format_is_srgb(format), A6XX_TEX_CONST_0_SRGB) |
A6XX_TEX_CONST_0_SWIZ_X(fdl6_swiz(swiz[0])) |
A6XX_TEX_CONST_0_SWIZ_Y(fdl6_swiz(swiz[1])) |
A6XX_TEX_CONST_0_SWIZ_Z(fdl6_swiz(swiz[2])) |
A6XX_TEX_CONST_0_SWIZ_W(fdl6_swiz(swiz[3]));
uint32_t descriptor[FDL6_TEX_CONST_DWORDS] = {
A6XX_TEX_CONST_0_FMT(fd6_texture_format(format, rsc->layout.tile_mode)) |
A6XX_TEX_CONST_0_SAMPLES(fd_msaa_samples(prsc->nr_samples)) |
A6XX_TEX_CONST_0_SWAP(WZYX) |
A6XX_TEX_CONST_0_TILE_MODE(TILE6_2) |
COND(util_format_is_srgb(format), A6XX_TEX_CONST_0_SRGB) |
A6XX_TEX_CONST_0_SWIZ_X(fdl6_swiz(swiz[0])) |
A6XX_TEX_CONST_0_SWIZ_Y(fdl6_swiz(swiz[1])) |
A6XX_TEX_CONST_0_SWIZ_Z(fdl6_swiz(swiz[2])) |
A6XX_TEX_CONST_0_SWIZ_W(fdl6_swiz(swiz[3])),
A6XX_TEX_CONST_1_WIDTH(pfb->width) |
A6XX_TEX_CONST_1_HEIGHT(pfb->height),
A6XX_TEX_CONST_2_PITCH(gmem->bin_w * gmem->cbuf_cpp[0]) |
A6XX_TEX_CONST_2_TYPE(A6XX_TEX_2D),
A6XX_TEX_CONST_3_ARRAY_PITCH(rsc->layout.layer_size),
A6XX_TEX_CONST_4_BASE_LO(screen->gmem_base),
A6XX_TEX_CONST_5_BASE_HI(screen->gmem_base >> 32) |
A6XX_TEX_CONST_5_DEPTH(1)
};
for (unsigned i = 0; i < num_patches; i++) {
struct fd_cs_patch *patch = fd_patch_element(&batch->fb_read_patches, i);
patch->cs[0] = texconst0;
patch->cs[2] = A6XX_TEX_CONST_2_PITCH(gmem->bin_w * gmem->cbuf_cpp[0]) |
A6XX_TEX_CONST_2_TYPE(A6XX_TEX_2D);
patch->cs[4] = A6XX_TEX_CONST_4_BASE_LO(screen->gmem_base);
patch->cs[5] = A6XX_TEX_CONST_5_BASE_HI(screen->gmem_base >> 32) |
A6XX_TEX_CONST_5_DEPTH(1);
memcpy(patch->cs, descriptor, FDL6_TEX_CONST_DWORDS * 4);
}
util_dynarray_clear(&batch->fb_read_patches);
}