mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-24 20:20:31 +01:00
zink: add functions for faster batch-usage completion checks
in cases where only a simple, non-definitive check is needed, these can be used to eliminate some ioctl overhead Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21583>
This commit is contained in:
parent
5b64d7267b
commit
772d92bfa6
4 changed files with 30 additions and 0 deletions
|
|
@ -832,6 +832,18 @@ zink_screen_usage_check_completion(struct zink_screen *screen, const struct zink
|
|||
return zink_screen_timeline_wait(screen, u->usage, 0);
|
||||
}
|
||||
|
||||
/* an even faster check that doesn't ioctl */
|
||||
bool
|
||||
zink_screen_usage_check_completion_fast(struct zink_screen *screen, const struct zink_batch_usage *u)
|
||||
{
|
||||
if (!zink_batch_usage_exists(u))
|
||||
return true;
|
||||
if (zink_batch_usage_is_unflushed(u))
|
||||
return false;
|
||||
|
||||
return zink_screen_check_last_finished(screen, u->usage);
|
||||
}
|
||||
|
||||
bool
|
||||
zink_batch_usage_check_completion(struct zink_context *ctx, const struct zink_batch_usage *u)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ zink_batch_usage_exists(const struct zink_batch_usage *u)
|
|||
|
||||
bool
|
||||
zink_screen_usage_check_completion(struct zink_screen *screen, const struct zink_batch_usage *u);
|
||||
bool
|
||||
zink_screen_usage_check_completion_fast(struct zink_screen *screen, const struct zink_batch_usage *u);
|
||||
|
||||
bool
|
||||
zink_batch_usage_check_completion(struct zink_context *ctx, const struct zink_batch_usage *u);
|
||||
|
|
|
|||
|
|
@ -173,6 +173,16 @@ zink_bo_usage_check_completion(struct zink_screen *screen, struct zink_bo *bo, e
|
|||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
zink_bo_usage_check_completion_fast(struct zink_screen *screen, struct zink_bo *bo, enum zink_resource_access access)
|
||||
{
|
||||
if (access & ZINK_RESOURCE_ACCESS_READ && !zink_screen_usage_check_completion_fast(screen, bo->reads))
|
||||
return false;
|
||||
if (access & ZINK_RESOURCE_ACCESS_WRITE && !zink_screen_usage_check_completion_fast(screen, bo->writes))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void
|
||||
zink_bo_usage_wait(struct zink_context *ctx, struct zink_bo *bo, enum zink_resource_access access)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -141,6 +141,12 @@ zink_resource_usage_check_completion(struct zink_screen *screen, struct zink_res
|
|||
return zink_bo_usage_check_completion(screen, res->obj->bo, access);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
zink_resource_usage_check_completion_fast(struct zink_screen *screen, struct zink_resource *res, enum zink_resource_access access)
|
||||
{
|
||||
return zink_bo_usage_check_completion_fast(screen, res->obj->bo, access);
|
||||
}
|
||||
|
||||
static inline void
|
||||
zink_resource_usage_try_wait(struct zink_context *ctx, struct zink_resource *res, enum zink_resource_access access)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue