summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2016-06-20 10:24:08 -0400
committerRobert Foss <robert.foss@collabora.com>2017-02-02 13:51:44 -0500
commit221848db977eb9b7f7f7ca8b62ec07c50630da46 (patch)
treee9187c5756bbedba65336549f2b0408a3866b0ac /lib/igt_kms.c
parent23e3028b1873ed3c65dae8bf4ca9199dd6353382 (diff)
lib/igt_kms: Add support for the IN_FENCE_FD property
Add support for the IN_FENCE_FD property to enable setting in fences for atomic commits. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Brian Starkey <brian.starkey@arm.com>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r--lib/igt_kms.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 142658a6..9b60d74a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -168,6 +168,7 @@ const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
"CRTC_H",
"FB_ID",
"CRTC_ID",
+ "IN_FENCE_FD",
"type",
"rotation"
};
@@ -1667,6 +1668,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
plane->type = type;
plane->pipe = pipe;
plane->drm_plane = drm_plane;
+ plane->fence_fd = -1;
if (is_atomic == 0) {
display->is_atomic = 1;
@@ -1994,6 +1996,11 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe,
plane->index,
fb_id);
+ if (plane->fence_fd >= 0) {
+ uint64_t fence_fd = (int64_t) plane->fence_fd;
+ igt_atomic_populate_plane_req(req, plane, IGT_PLANE_IN_FENCE_FD, fence_fd);
+ }
+
if (plane->fb_changed) {
igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_ID, fb_id ? crtc_id : 0);
igt_atomic_populate_plane_req(req, plane, IGT_PLANE_FB_ID, fb_id);
@@ -2815,6 +2822,24 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
plane->size_changed = true;
}
+/**
+ * igt_plane_set_fence_fd:
+ * @plane: plane
+ * @fence_fd: fence fd, disable fence_fd by setting it to -1
+ *
+ * This function sets a fence fd to enable a commit to wait for some event to
+ * occur before completing.
+ */
+void igt_plane_set_fence_fd(igt_plane_t *plane, int fence_fd)
+{
+ close(plane->fence_fd);
+
+ if (fcntl(fence_fd, F_GETFD) != -1)
+ plane->fence_fd = dup(fence_fd);
+ else
+ plane->fence_fd = -1;
+}
+
void igt_plane_set_position(igt_plane_t *plane, int x, int y)
{
igt_pipe_t *pipe = plane->pipe;