freedreno: Extract helper to check for batch dependency
Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18200>
This commit is contained in:
@@ -403,12 +403,18 @@ recursive_dependents_mask(struct fd_batch *batch)
|
||||
return dependents_mask;
|
||||
}
|
||||
|
||||
bool
|
||||
fd_batch_has_dep(struct fd_batch *batch, struct fd_batch *dep)
|
||||
{
|
||||
return !!(batch->dependents_mask & (1 << dep->idx));
|
||||
}
|
||||
|
||||
void
|
||||
fd_batch_add_dep(struct fd_batch *batch, struct fd_batch *dep)
|
||||
{
|
||||
fd_screen_assert_locked(batch->ctx->screen);
|
||||
|
||||
if (batch->dependents_mask & (1 << dep->idx))
|
||||
if (fd_batch_has_dep(batch, dep))
|
||||
return;
|
||||
|
||||
/* a loop should not be possible */
|
||||
|
||||
@@ -261,6 +261,7 @@ struct fd_batch *fd_batch_create(struct fd_context *ctx, bool nondraw);
|
||||
|
||||
void fd_batch_reset(struct fd_batch *batch) 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;
|
||||
void fd_batch_resource_write(struct fd_batch *batch,
|
||||
struct fd_resource *rsc) assert_dt;
|
||||
|
||||
@@ -380,7 +380,7 @@ alloc_batch_locked(struct fd_batch_cache *cache, struct fd_context *ctx,
|
||||
struct fd_batch *other = cache->batches[i];
|
||||
if (!other)
|
||||
continue;
|
||||
if (other->dependents_mask & (1 << flush_batch->idx)) {
|
||||
if (fd_batch_has_dep(other, flush_batch)) {
|
||||
other->dependents_mask &= ~(1 << flush_batch->idx);
|
||||
struct fd_batch *ref = flush_batch;
|
||||
fd_batch_reference_locked(&ref, NULL);
|
||||
|
||||
Reference in New Issue
Block a user