freedreno: Handle xfb invalidation

So using the same buffer for CPU writes and GPU writes might be kinda
unusual.  But I noticed we were missing handling for the case while
debugging something unrelated.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18732>
This commit is contained in:
Rob Clark 2022-09-20 14:15:43 -07:00 committed by Marge Bot
parent 3449b2187e
commit 8300554ba1
2 changed files with 14 additions and 0 deletions

View file

@ -85,6 +85,18 @@ rebind_resource_in_ctx(struct fd_context *ctx,
}
}
/* xfb/so buffers: */
if (rsc->dirty & FD_DIRTY_STREAMOUT) {
struct fd_streamout_stateobj *so = &ctx->streamout;
for (unsigned i = 0;
i < so->num_targets && !(ctx->dirty & FD_DIRTY_STREAMOUT);
i++) {
if (so->targets[i]->buffer == prsc)
fd_context_dirty(ctx, FD_DIRTY_STREAMOUT);
}
}
const enum fd_dirty_3d_state per_stage_dirty =
FD_DIRTY_CONST | FD_DIRTY_TEX | FD_DIRTY_IMAGE | FD_DIRTY_SSBO;

View file

@ -611,6 +611,8 @@ fd_set_stream_output_targets(struct pipe_context *pctx, unsigned num_targets,
ctx->streamout.verts_written = 0;
}
if (so->targets[i])
fd_resource_set_usage(so->targets[i]->buffer, FD_DIRTY_STREAMOUT);
pipe_so_target_reference(&so->targets[i], targets[i]);
}