etnaviv: drm: export BO idle check function

The ability to check if a BO is idle is not only useful in the
buffer cache, but also in other parts of the winsys and even the
pipe driver. Make this functionality available in the interface.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14159>
This commit is contained in:
Lucas Stach 2021-12-10 22:17:15 +01:00 committed by Marge Bot
parent 1b1f8592c0
commit 77ebbcbf9a
3 changed files with 10 additions and 9 deletions

View File

@ -43,6 +43,14 @@ static void set_name(struct etna_bo *bo, uint32_t name)
_mesa_hash_table_insert(bo->dev->name_table, &bo->name, bo);
}
int etna_bo_is_idle(struct etna_bo *bo)
{
return etna_bo_cpu_prep(bo,
DRM_ETNA_PREP_READ |
DRM_ETNA_PREP_WRITE |
DRM_ETNA_PREP_NOSYNC) == 0;
}
/* Called under etna_drm_table_lock */
void _etna_bo_del(struct etna_bo *bo)
{

View File

@ -110,14 +110,6 @@ static struct etna_bo_bucket *get_bucket(struct etna_bo_cache *cache, uint32_t s
return NULL;
}
static int is_idle(struct etna_bo *bo)
{
return etna_bo_cpu_prep(bo,
DRM_ETNA_PREP_READ |
DRM_ETNA_PREP_WRITE |
DRM_ETNA_PREP_NOSYNC) == 0;
}
static struct etna_bo *find_in_bucket(struct etna_bo_bucket *bucket, uint32_t flags)
{
struct etna_bo *bo = NULL, *tmp;
@ -133,7 +125,7 @@ static struct etna_bo *find_in_bucket(struct etna_bo_bucket *bucket, uint32_t fl
continue;
/* check if the first BO with matching flags is idle */
if (is_idle(bo)) {
if (etna_bo_is_idle(bo)) {
list_delinit(&bo->list);
goto out_unlock;
}

View File

@ -133,6 +133,7 @@ uint32_t etna_bo_gpu_va(struct etna_bo *bo);
void * etna_bo_map(struct etna_bo *bo);
int etna_bo_cpu_prep(struct etna_bo *bo, uint32_t op);
void etna_bo_cpu_fini(struct etna_bo *bo);
int etna_bo_is_idle(struct etna_bo *bo);
/* cmd stream functions: