freedreno: Skip staging blits from uninitialized resources.

When storing depth- or stencil-only texture data that has been packed into
a depth/stencil texture, the tex store gets PIPE_MAP_READ added onto it
since the other channel will get ORed into the incoming data, but
sometimes we know that the other component is undefined because the whole
texture is either fresh or just invalidated.

Cleans up a confusing extra blit in a dEQP case I've been debugging, and
should be less work for dEQP CI.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11452>
This commit is contained in:
Emma Anholt 2021-06-17 13:24:45 -07:00 committed by Marge Bot
parent 4018c5f928
commit df7fdae127

View file

@ -797,6 +797,13 @@ resource_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
tc_assert_driver_thread(ctx->tc);
/* Strip the read flag if the buffer has been invalidated (or is freshly
* created). Avoids extra staging blits of undefined data on glTexSubImage of
* a fresh DEPTH_COMPONENT or STENCIL_INDEX texture being stored as z24s8.
*/
if (!rsc->valid)
usage &= ~PIPE_MAP_READ;
/* we always need a staging texture for tiled buffers:
*
* TODO we might sometimes want to *also* shadow the resource to avoid