linux/include/uapi/drm
Robert Bragg eec688e142 drm/i915: Add i915 perf infrastructure
Adds base i915 perf infrastructure for Gen performance metrics.

This adds a DRM_IOCTL_I915_PERF_OPEN ioctl that takes an array of uint64
properties to configure a stream of metrics and returns a new fd usable
with standard VFS system calls including read() to read typed and sized
records; ioctl() to enable or disable capture and poll() to wait for
data.

A stream is opened something like:

  uint64_t properties[] = {
      /* Single context sampling */
      DRM_I915_PERF_PROP_CTX_HANDLE,        ctx_handle,

      /* Include OA reports in samples */
      DRM_I915_PERF_PROP_SAMPLE_OA,         true,

      /* OA unit configuration */
      DRM_I915_PERF_PROP_OA_METRICS_SET,    metrics_set_id,
      DRM_I915_PERF_PROP_OA_FORMAT,         report_format,
      DRM_I915_PERF_PROP_OA_EXPONENT,       period_exponent,
   };
   struct drm_i915_perf_open_param parm = {
      .flags = I915_PERF_FLAG_FD_CLOEXEC |
               I915_PERF_FLAG_FD_NONBLOCK |
               I915_PERF_FLAG_DISABLED,
      .properties_ptr = (uint64_t)properties,
      .num_properties = sizeof(properties) / 16,
   };
   int fd = drmIoctl(drm_fd, DRM_IOCTL_I915_PERF_OPEN, &param);

Records read all start with a common { type, size } header with
DRM_I915_PERF_RECORD_SAMPLE being of most interest. Sample records
contain an extensible number of fields and it's the
DRM_I915_PERF_PROP_SAMPLE_xyz properties given when opening that
determine what's included in every sample.

No specific streams are supported yet so any attempt to open a stream
will return an error.

v2:
    use i915_gem_context_get() - Chris Wilson
v3:
    update read() interface to avoid passing state struct - Chris Wilson
    fix some rebase fallout, with i915-perf init/deinit
v4:
    s/DRM_IORW/DRM_IOW/ - Emil Velikov

Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Sourab Gupta <sourab.gupta@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161107194957.3385-2-robert@sixbynine.org
2016-11-22 14:27:18 +01:00
..
amdgpu_drm.h drm/amdgpu: add the interface of waiting multiple fences (v4) 2016-11-09 00:28:42 +05:30
armada_drm.h drm/armada: add extern C guard for the UAPI header 2016-05-13 13:57:02 +01:00
drm.h drm: Add DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags v2 2016-08-10 14:28:09 -04:00
drm_fourcc.h drm: add extern C guard for the UAPI headers 2016-05-13 13:57:17 +01:00
drm_mode.h Revert "drm: Add and handle new aspect ratios in DRM layer" 2016-11-15 15:01:31 +01:00
drm_sarea.h drm: add extern C guard for the UAPI headers 2016-05-13 13:57:17 +01:00
etnaviv_drm.h drm/etnaviv: add extern C guard for the UAPI header 2016-05-13 13:57:18 +01:00
exynos_drm.h drm/exynos: add extern C guard for the UAPI header 2016-05-13 14:02:24 +01:00
i810_drm.h drm/i810: add extern C guard for the UAPI header 2016-05-13 14:05:17 +01:00
i915_drm.h drm/i915: Add i915 perf infrastructure 2016-11-22 14:27:18 +01:00
Kbuild Merge tag 'drm-vc4-next-2015-12-11' of http://github.com/anholt/linux into drm-next 2015-12-15 10:43:27 +10:00
mga_drm.h drm/mga: add extern C guard for the UAPI header 2016-05-13 14:06:07 +01:00
msm_drm.h drm/msm: submit support for out-fences 2016-09-15 17:47:40 -04:00
nouveau_drm.h drm/nouveau: drop drm/ prefix from include 2016-05-13 14:06:10 +01:00
omap_drm.h drm/omap: add extern C guard for the UAPI header 2016-05-13 14:06:11 +01:00
qxl_drm.h drm/qxl: add extern C guard for the UAPI header 2016-05-13 14:06:12 +01:00
r128_drm.h drm/r128: add extern C guard for the UAPI header 2016-05-13 14:06:13 +01:00
radeon_drm.h drm/radeon: add extern C guard for the UAPI header 2016-05-13 14:06:14 +01:00
savage_drm.h drm/savage: add extern C guard for the UAPI header 2016-05-13 14:06:15 +01:00
sis_drm.h drm/sis: add extern C guard for the UAPI header 2016-05-13 14:06:16 +01:00
tegra_drm.h drm/tegra: add extern C guard for the UAPI header 2016-05-13 14:06:17 +01:00
vc4_drm.h drm/vc4: Add fragment shader threading support 2016-11-16 13:25:26 -08:00
vgem_drm.h drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-07-18 08:54:55 +02:00
via_drm.h drm/via: add extern C guard for the UAPI header 2016-05-13 14:06:19 +01:00
virtgpu_drm.h drm/virgl: add extern C guard for the UAPI header 2016-05-13 14:06:20 +01:00
vmwgfx_drm.h drm/vmwgfx: add extern C guard for the UAPI header 2016-05-13 14:06:21 +01:00