History

dma-buf/sync_file: Add SET_DEADLINE ioctl

The initial purpose is for igt tests, but this would also be useful for compositors that wait until close to vblank deadline to make decisions about which frame to show. The igt tests can be found at: https://gitlab.freedesktop.org/robclark/igt-gpu-tools/-/commits/fence-deadline v2: Clarify the timebase, add link to igt tests v3: Use u64 value in ns to express deadline. v4: More doc

Rob Clark committed 3 years ago

Commit 63ee4451 parent 8570c273 files · +43 −1Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/sync_file.h+22−0
@@ -76,6 +76,27 @@ struct sync_file_info { · 75 unmodified lines
7676 __u64 sync_fence_info;
7777 };
7878
79+/**
80+ * struct sync_set_deadline - SYNC_IOC_SET_DEADLINE - set a deadline hint on a fence
81+ * @deadline_ns: absolute time of the deadline
82+ * @pad: must be zero
83+ *
84+ * Allows userspace to set a deadline on a fence, see &dma_fence_set_deadline
85+ *
86+ * The timebase for the deadline is CLOCK_MONOTONIC (same as vblank). For
87+ * example
88+ *
89+ * clock_gettime(CLOCK_MONOTONIC, &t);
90+ * deadline_ns = (t.tv_sec * 1000000000L) + t.tv_nsec + ns_until_deadline
91+ */
92+struct sync_set_deadline {
93+ __u64 deadline_ns;
94+ /* Not strictly needed for alignment but gives some possibility
95+ * for future extension:
96+ */
97+ __u64 pad;
98+};
99+
79100 #define SYNC_IOC_MAGIC '>'
80101
81102 /*
@@ -87,5 +108,6 @@ struct sync_file_info { · 5 unmodified lines
87108
88109 #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 3, struct sync_merge_data)
89110 #define SYNC_IOC_FILE_INFO _IOWR(SYNC_IOC_MAGIC, 4, struct sync_file_info)
111+#define SYNC_IOC_SET_DEADLINE _IOW(SYNC_IOC_MAGIC, 5, struct sync_set_deadline)
90112
91113 #endif /* _UAPI_LINUX_SYNC_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t