[igt-dev] [PATCH i-g-t 2/6] include/drm-uapi: Update i915_drm.h for perf OA APIs

Umesh Nerlige Ramappa
2020-03-03T22:38:15Z

From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

Add APIs to enable/disable interrupts in perf OA.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
include/drm-uapi/i915_drm.h | 41 +++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)

diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h
index 3794e768..fca6ab4d 100644
--- a/include/drm-uapi/i915_drm.h
+++ b/include/drm-uapi/i915_drm.h
@@ -1969,6 +1969,26 @@ enum drm_i915_perf_property_id {
*/
DRM_I915_PERF_PROP_HOLD_PREEMPTION,

+ /**
+ * Specifying this property sets up a hrtimer in nanoseconds at which
+ * the i915 driver will check the OA buffer for available data. A
+ * value of 0 means no hrtimer will be started. Values below 100
+ * microseconds are not allowed.
+ *
+ * This property is available in perf revision 4.
+ */
+ DRM_I915_PERF_PROP_POLL_OA_DELAY,
+
+ /**
+ * Specifying this property sets up the interrupt mechanism for the OA
+ * buffer in i915. This option in conjuction with a long polling delay
+ * for avaibility of OA data can reduce CPU load significantly if you
+ * do not care about OA data being read as soon as it's available.
+ *
+ * This property is available in perf revision 5.
+ */
+ DRM_I915_PERF_PROP_OA_ENABLE_INTERRUPT,
+
DRM_I915_PERF_PROP_MAX /* non-ABI */
};

@@ -2024,6 +2044,27 @@ struct drm_i915_perf_open_param {
*/
#define I915_PERF_IOCTL_CONFIG _IO('i', 0x2)

+/**
+ * Actively check the availability of data from a stream.
+ *
+ * A stream data availability can be driven by two types of events :
+ *
+ * - if enabled, the kernel's hrtimer checking the amount of available data
+ * in the OA buffer through head/tail registers.
+ *
+ * - if enabled, the OA unit's interrupt mechanism
+ *
+ * The kernel hrtimer incur a cost of running callback at fixed time
+ * intervals, while the OA interrupt might only happen rarely. In the
+ * situation where the application has disabled the kernel's hrtimer and only
+ * uses the OA interrupt to know about available data, the application can
+ * request an active check of the available OA data through this ioctl. This
+ * will make any data in the OA buffer available with either poll() or read().
+ *
+ * This ioctl is available in perf revision 6.
+ */
+#define I915_PERF_IOCTL_FLUSH_DATA _IO('i', 0x3)
+
/**
* Common to all i915 perf records
*/
--
2.20.1