]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/atomic-helper: support more than one write fence in drm_gem_plane_helper_prepare_fb
authorChristian König <christian.koenig@amd.com>
Thu, 4 Nov 2021 14:18:46 +0000 (15:18 +0100)
committerChristian König <christian.koenig@amd.com>
Sun, 3 Apr 2022 18:14:39 +0000 (20:14 +0200)
Use dma_resv_get_singleton() here to eventually get more than one write
fence as single fence.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220321135856.1331-13-christian.koenig@amd.com
drivers/gpu/drm/drm_gem_atomic_helper.c

index c3189afe10cb09d51cada305f57a7ab3712606a5..9338ddb7edff1f047d7d7647163e10afd66e8b26 100644 (file)
  */
 int drm_gem_plane_helper_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state)
 {
-       struct dma_resv_iter cursor;
        struct drm_gem_object *obj;
        struct dma_fence *fence;
+       int ret;
 
        if (!state->fb)
                return 0;
 
        obj = drm_gem_fb_get_obj(state->fb, 0);
-       dma_resv_iter_begin(&cursor, obj->resv, false);
-       dma_resv_for_each_fence_unlocked(&cursor, fence) {
-               /* TODO: Currently there should be only one write fence, so this
-                * here works fine. But drm_atomic_set_fence_for_plane() should
-                * be changed to be able to handle more fences in general for
-                * multiple BOs per fb anyway. */
-               dma_fence_get(fence);
-               break;
-       }
-       dma_resv_iter_end(&cursor);
+       ret = dma_resv_get_singleton(obj->resv, false, &fence);
+       if (ret)
+               return ret;
 
+       /* TODO: drm_atomic_set_fence_for_plane() should be changed to be able
+        * to handle more fences in general for multiple BOs per fb.
+        */
        drm_atomic_set_fence_for_plane(state, fence);
        return 0;
 }