freedreno/batch: Add helper to set fb state

Stop open-coding and add a helper.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22895>
This commit is contained in:
Rob Clark 2023-04-22 12:32:21 -07:00 committed by Marge Bot
parent 9af6f25741
commit c29e9dc054
4 changed files with 12 additions and 1 deletions

View file

@ -339,6 +339,14 @@ batch_flush(struct fd_batch *batch) assert_dt
cleanup_submit(batch);
}
void
fd_batch_set_fb(struct fd_batch *batch, const struct pipe_framebuffer_state *pfb)
{
assert(!batch->nondraw);
util_copy_framebuffer_state(&batch->framebuffer, pfb);
}
/* NOTE: could drop the last ref to batch
*/
void

View file

@ -256,6 +256,8 @@ struct fd_batch {
struct fd_batch *fd_batch_create(struct fd_context *ctx, bool nondraw);
void fd_batch_set_fb(struct fd_batch *batch, const struct pipe_framebuffer_state *pfb) assert_dt;
void fd_batch_flush(struct fd_batch *batch) assert_dt;
bool fd_batch_has_dep(struct fd_batch *batch, struct fd_batch *dep) assert_dt;
void fd_batch_add_dep(struct fd_batch *batch, struct fd_batch *dep) assert_dt;

View file

@ -552,5 +552,7 @@ fd_batch_from_fb(struct fd_context *ctx,
struct fd_batch *batch = batch_from_key(ctx, key);
fd_screen_unlock(ctx->screen);
fd_batch_set_fb(batch, pfb);
return batch;
}

View file

@ -343,7 +343,6 @@ fd_context_batch(struct fd_context *ctx)
if (unlikely(!batch)) {
batch =
fd_batch_from_fb(ctx, &ctx->framebuffer);
util_copy_framebuffer_state(&batch->framebuffer, &ctx->framebuffer);
fd_batch_reference(&ctx->batch, batch);
fd_context_all_dirty(ctx);
}