headers: add i915-perf interface to i915_drm.h
PATCH 1/1 headers: add i915-perf interface to i915_drm.h
This interface gives access to Gen graphics Observability counters
--- include/drm/i915_drm.h | 134 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+)
include/drm/i915_drm.h +134 -0
@@ -230,6 +230,7 @@ typedef struct _drm_i915_sarea {#define DRM_I915_GEM_USERPTR 0x33#define DRM_I915_GEM_CONTEXT_GETPARAM 0x34#define DRM_I915_GEM_CONTEXT_SETPARAM 0x35 +#define DRM_I915_PERF_OPEN 0x36#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -283,6 +284,7 @@ typedef struct _drm_i915_sarea {#define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr)#define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param)#define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param) +#define DRM_IOCTL_I915_PERF_OPEN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_PERF_OPEN, struct drm_i915_perf_open_param)/* Allow drivers to submit batchbuffers directly to hardware, relying * on the security mechanisms provided by hardware.
@@ -1172,4 +1174,136 @@ struct drm_i915_gem_context_param { __u64 value; }; +enum drm_i915_oa_format { +I915_OA_FORMAT_A13 =1 , +I915_OA_FORMAT_A29 , +I915_OA_FORMAT_A13_B8_C8 , +I915_OA_FORMAT_B4_C8 , +I915_OA_FORMAT_A45_B8_C8 , +I915_OA_FORMAT_B4_C8_A16 , +I915_OA_FORMAT_C4_B8 , + +I915_OA_FORMAT_MAX /* non-ABI */ +}; + +enum drm_i915_perf_property_id { +/** +* Open the stream for a specific context handle (as used with +* execbuffer2). A stream opened for a specific context this way +* won't typically require root privileges. +*/ +DRM_I915_PERF_PROP_CTX_HANDLE =1 , + +/** +* A value of 1 requests the inclusion of raw OA unit reports as +* part of stream samples. +*/ +DRM_I915_PERF_PROP_SAMPLE_OA , + +/** +* The value specifies which set of OA unit metrics should be +* be configured, defining the contents of any OA unit reports. +*/ +DRM_I915_PERF_PROP_OA_METRICS_SET , + +/** +* The value specifies the size and layout of OA unit reports. +*/ +DRM_I915_PERF_PROP_OA_FORMAT , + +/** +* Specifying this property implicitly requests periodic OA unit +* sampling and (at least on Haswell) the sampling frequency is derived +* from this exponent as follows: +* +* 80ns * 2^(period_exponent + 1) +*/ +DRM_I915_PERF_PROP_OA_EXPONENT , + +DRM_I915_PERF_PROP_MAX /* non-ABI */ +}; + +struct drm_i915_perf_open_param { +__u32 flags; +#define I915_PERF_FLAG_FD_CLOEXEC (1<<0) +#define I915_PERF_FLAG_FD_NONBLOCK (1<<1) +#define I915_PERF_FLAG_DISABLED (1<<2) + +/** The number of u64 (id, value) pairs */ +__u32 num_properties; + +/** +* Pointer to array of u64 (id, value) pairs configuring the stream +* to open. +*/ +__u64 properties_ptr; +}; + +/** +* Enable data capture for a stream that was either opened in a disabled state +* via I915_PERF_FLAG_DISABLED or was later disabled via +* I915_PERF_IOCTL_DISABLE. +* +* It is intended to be cheaper to disable and enable a stream than it may be +* to close and re-open a stream with the same configuration. +* +* It's undefined whether any pending data for the stream will be lost. +*/ +#define I915_PERF_IOCTL_ENABLE _IO('i', 0x0) + +/** +* Disable data capture for a stream. +* +* It is an error to try and read a stream that is disabled. +*/ +#define I915_PERF_IOCTL_DISABLE _IO('i', 0x1) + +/** +* Common to all i915 perf records +*/ +struct drm_i915_perf_record_header { +__u32 type; +__u16 pad; +__u16 size; +}; + +enum drm_i915_perf_record_type { + +/** +* Samples are the work horse record type whose contents are extensible +* and defined when opening an i915 perf stream based on the given +* properties. +* +* Boolean properties following the naming convention +* DRM_I915_PERF_SAMPLE_xyz_PROP request the inclusion of 'xyz' data in +* every sample. +* +* The order of these sample properties given by userspace has no +* affect on the ordering of data within a sample. The order is +* documented here. +* +* struct { +* struct drm_i915_perf_record_header header; +* +* { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA +* }; +*/ +DRM_I915_PERF_RECORD_SAMPLE =1 , + +/* +* Indicates that one or more OA reports were not written by the +* hardware. This can happen for example if an MI_REPORT_PERF_COUNT +* command collides with periodic sampling - which would be more likely +* at higher sampling frequencies. +*/ +DRM_I915_PERF_RECORD_OA_REPORT_LOST =2 , + +/** +* An error occurred that resulted in all pending OA reports being lost. +*/ +DRM_I915_PERF_RECORD_OA_BUFFER_LOST =3 , + +DRM_I915_PERF_RECORD_MAX /* non-ABI */ +}; +#endif /* _I915_DRM_H_ */
Signature · 6 lines
2.10.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Robert
Just a couple of trivial suggestions:
- git config --local format.subjectPrefix "PATCH libdrm"
- make sure that the headers are generated via `make headers_install'
and state the tree/sha that you've used.
See 9af2ccdef cc9a53f07 or 89cdda3d5.
Thanks
EmilP.S. /me goes to add a README with the above instructions
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Ah, yup, I missed the [PATH libdrm] convention sorry.
I noticed some other updates based on make headers_install, though I also saw a bunch of unrelated noise with e.g. mocs and C++ guard changes so figured I'd avoid those for now, while I was pretty much expecting I'd need to re-send this later. I just wanted to get a patch out in case it could be convenient for folks looking to run my i915-perf igt tests.
I don't have a meaningful tree/sha to reference while it's chicken/egg atm the order of landing i915-perf changes.
tbh I didn't read the README before sending and not sure I'd expect to find this kind of info there. Maybe if there were a CONTRIBUTING doc or something along those lines a note could go there. I probably should have just thought to check for a format-patch infix since libdrm isn't the only fd.o project with this, it was probably a bit of laziness on my part so sorry about that.
thanks for the note though, I've updated my git [format] config now.
- Robert
Quoted 8 lines · Emil Velikov
Hi Robert
Just a couple of trivial suggestions:
- git config --local format.subjectPrefix "PATCH libdrm"
- make sure that the headers are generated via `makeheaders_install'
and state the tree/sha that you've used.
See9af2ccdefcc9a53f07or89cdda3d5.
Quoted 4 lines
Thanks
EmilP.S. /me goes to add a README with the above instructions
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel