@@ -29,6 +29,7 @@
#include <drm/drmP.h>
#include <drm/drm_atomic.h>
#include <drm/drm_plane_helper.h>
+#include <linux/sync_file.h>
/**
* drm_atomic_state_default_release -
@@ -795,6 +796,14 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
return -EINVAL;
}
+#ifdef CONFIG_SYNC_FILE
+ if (state->fence_fd >= 0) {
+ state->fences = sync_file_fences_get(state->fence_fd);
+ if (!state->fences)
+ return -EINVAL;
+ }
+#endif
+
return 0;
}
@@ -977,14 +977,12 @@ static void wait_for_fences(struct drm_device *dev,
int i;
for_each_plane_in_state(state, plane, plane_state, i) {
- if (!plane->state->fence)
+ if (!plane->state->fences)
continue;
WARN_ON(!plane->state->fb);
- fence_wait(plane->state->fence, false);
- fence_put(plane->state->fence);
- plane->state->fence = NULL;
+ fence_collection_wait(plane->state->fences);
}
}
@@ -2654,6 +2652,9 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
{
if (state->fb)
drm_framebuffer_unreference(state->fb);
+
+ if (state->fences)
+ fence_collection_put(state->fences);
}
EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state);
@@ -1257,7 +1257,7 @@ struct drm_plane_state {
struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
- struct fence *fence;
+ struct fence_collection *fences;
int fence_fd;
/* Signed dest location allows it to be partially off screen */