drm: use new iterator in drm_gem_fence_array_add_implicit v3
Simplifying the code a bit. v2: add missing rcu_read_lock()/unlock() v3: switch to locked version Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-24-christian.koenig@amd.com
This commit is contained in:
Родитель
a585070f26
Коммит
7cd80132ae
|
@ -1340,31 +1340,15 @@ int drm_gem_fence_array_add_implicit(struct xarray *fence_array,
|
||||||
struct drm_gem_object *obj,
|
struct drm_gem_object *obj,
|
||||||
bool write)
|
bool write)
|
||||||
{
|
{
|
||||||
int ret;
|
struct dma_resv_iter cursor;
|
||||||
struct dma_fence **fences;
|
struct dma_fence *fence;
|
||||||
unsigned int i, fence_count;
|
int ret = 0;
|
||||||
|
|
||||||
if (!write) {
|
dma_resv_for_each_fence(&cursor, obj->resv, write, fence) {
|
||||||
struct dma_fence *fence =
|
ret = drm_gem_fence_array_add(fence_array, fence);
|
||||||
dma_resv_get_excl_unlocked(obj->resv);
|
|
||||||
|
|
||||||
return drm_gem_fence_array_add(fence_array, fence);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = dma_resv_get_fences(obj->resv, NULL,
|
|
||||||
&fence_count, &fences);
|
|
||||||
if (ret || !fence_count)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
for (i = 0; i < fence_count; i++) {
|
|
||||||
ret = drm_gem_fence_array_add(fence_array, fences[i]);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < fence_count; i++)
|
|
||||||
dma_fence_put(fences[i]);
|
|
||||||
kfree(fences);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(drm_gem_fence_array_add_implicit);
|
EXPORT_SYMBOL(drm_gem_fence_array_add_implicit);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче