diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2022-12-01 20:48:46 +0300 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2023-02-01 18:32:26 +0300 |
commit | 764be12345c34d4a8f066c4e25682028bcd1046a (patch) | |
tree | 2a1183fc6a531241d72a5a8bdb179d68a0b5726e /drivers/gpu/drm/etnaviv/etnaviv_gpu.c | |
parent | 2cd5bd98a5578f5eb14d65c6173841c5822aac44 (diff) | |
download | linux-764be12345c34d4a8f066c4e25682028bcd1046a.tar.xz |
drm/etnaviv: convert user fence tracking to XArray
This simplifies the driver code a bit, as XArray already provides
internal locking. IDRs are implemented using XArrays anyways, so
this drops one level of unneeded abstraction.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm/etnaviv/etnaviv_gpu.c')
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index 7bb193b6f1fb..5f14effc963e 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1244,7 +1244,7 @@ int etnaviv_gpu_wait_fence_interruptible(struct etnaviv_gpu *gpu, * pretends we didn't find a fence in that case. */ rcu_read_lock(); - fence = idr_find(&gpu->fence_idr, id); + fence = xa_load(&gpu->user_fences, id); if (fence) fence = dma_fence_get_rcu(fence); rcu_read_unlock(); @@ -1744,7 +1744,7 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master, gpu->drm = drm; gpu->fence_context = dma_fence_context_alloc(1); - idr_init(&gpu->fence_idr); + xa_init_flags(&gpu->user_fences, XA_FLAGS_ALLOC); spin_lock_init(&gpu->fence_spinlock); INIT_WORK(&gpu->sync_point_work, sync_point_worker); @@ -1798,7 +1798,7 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master, } gpu->drm = NULL; - idr_destroy(&gpu->fence_idr); + xa_destroy(&gpu->user_fences); if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) thermal_cooling_device_unregister(gpu->cooling); @@ -1831,7 +1831,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) gpu->dev = &pdev->dev; mutex_init(&gpu->lock); mutex_init(&gpu->sched_lock); - mutex_init(&gpu->idr_lock); /* Map registers: */ gpu->mmio = devm_platform_ioremap_resource(pdev, 0); |