mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 19:20:08 +01:00
zink: always check submit_count to disambiguate when checking/waiting
this may otherwise erroneously detect usage on a batch state which has already been reset cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33848>
This commit is contained in:
parent
78a80b9bf1
commit
61b0955308
3 changed files with 16 additions and 13 deletions
|
|
@ -1116,10 +1116,13 @@ zink_batch_usage_check_completion(struct zink_context *ctx, const struct zink_ba
|
|||
}
|
||||
|
||||
static void
|
||||
batch_usage_wait(struct zink_context *ctx, struct zink_batch_usage *u, bool trywait)
|
||||
batch_usage_wait(struct zink_context *ctx, struct zink_batch_usage *u, unsigned submit_count, bool trywait)
|
||||
{
|
||||
if (!zink_batch_usage_exists(u))
|
||||
return;
|
||||
/* this batch state was already completed and reset */
|
||||
if (u->submit_count - submit_count > 1)
|
||||
return;
|
||||
if (zink_batch_usage_is_unflushed(u)) {
|
||||
if (likely(u == &ctx->bs->usage))
|
||||
ctx->base.flush(&ctx->base, NULL, PIPE_FLUSH_HINT_FINISH);
|
||||
|
|
@ -1137,13 +1140,13 @@ batch_usage_wait(struct zink_context *ctx, struct zink_batch_usage *u, bool tryw
|
|||
}
|
||||
|
||||
void
|
||||
zink_batch_usage_wait(struct zink_context *ctx, struct zink_batch_usage *u)
|
||||
zink_batch_usage_wait(struct zink_context *ctx, struct zink_batch_usage *u, unsigned submit_count)
|
||||
{
|
||||
batch_usage_wait(ctx, u, false);
|
||||
batch_usage_wait(ctx, u, submit_count, false);
|
||||
}
|
||||
|
||||
void
|
||||
zink_batch_usage_try_wait(struct zink_context *ctx, struct zink_batch_usage *u)
|
||||
zink_batch_usage_try_wait(struct zink_context *ctx, struct zink_batch_usage *u, unsigned submit_count)
|
||||
{
|
||||
batch_usage_wait(ctx, u, true);
|
||||
batch_usage_wait(ctx, u, submit_count, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,10 +119,10 @@ bool
|
|||
zink_batch_usage_check_completion(struct zink_context *ctx, const struct zink_batch_usage *u);
|
||||
|
||||
void
|
||||
zink_batch_usage_wait(struct zink_context *ctx, struct zink_batch_usage *u);
|
||||
zink_batch_usage_wait(struct zink_context *ctx, struct zink_batch_usage *u, unsigned submit_count);
|
||||
|
||||
void
|
||||
zink_batch_usage_try_wait(struct zink_context *ctx, struct zink_batch_usage *u);
|
||||
zink_batch_usage_try_wait(struct zink_context *ctx, struct zink_batch_usage *u, unsigned submit_count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,8 +145,8 @@ zink_bo_commit(struct zink_context *ctx, struct zink_resource *res, unsigned lev
|
|||
static ALWAYS_INLINE bool
|
||||
zink_bo_has_unflushed_usage(const struct zink_bo *bo)
|
||||
{
|
||||
return zink_batch_usage_is_unflushed(bo->reads.u) ||
|
||||
zink_batch_usage_is_unflushed(bo->writes.u);
|
||||
return (bo->reads.u && bo->reads.submit_count == bo->reads.u->submit_count && zink_batch_usage_is_unflushed(bo->reads.u)) ||
|
||||
(bo->writes.u && bo->writes.submit_count == bo->writes.u->submit_count && zink_batch_usage_is_unflushed(bo->writes.u));
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE bool
|
||||
|
|
@ -188,18 +188,18 @@ static ALWAYS_INLINE void
|
|||
zink_bo_usage_wait(struct zink_context *ctx, struct zink_bo *bo, enum zink_resource_access access)
|
||||
{
|
||||
if (access & ZINK_RESOURCE_ACCESS_READ)
|
||||
zink_batch_usage_wait(ctx, bo->reads.u);
|
||||
zink_batch_usage_wait(ctx, bo->reads.u, bo->reads.submit_count);
|
||||
if (access & ZINK_RESOURCE_ACCESS_WRITE)
|
||||
zink_batch_usage_wait(ctx, bo->writes.u);
|
||||
zink_batch_usage_wait(ctx, bo->writes.u, bo->writes.submit_count);
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
zink_bo_usage_try_wait(struct zink_context *ctx, struct zink_bo *bo, enum zink_resource_access access)
|
||||
{
|
||||
if (access & ZINK_RESOURCE_ACCESS_READ)
|
||||
zink_batch_usage_try_wait(ctx, bo->reads.u);
|
||||
zink_batch_usage_try_wait(ctx, bo->reads.u, bo->reads.submit_count);
|
||||
if (access & ZINK_RESOURCE_ACCESS_WRITE)
|
||||
zink_batch_usage_try_wait(ctx, bo->writes.u);
|
||||
zink_batch_usage_try_wait(ctx, bo->writes.u, bo->writes.submit_count);
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue