History

drm/i915: Enable i915 perf stream for Haswell OA unit

Gen graphics hardware can be set up to periodically write snapshots of performance counters into a circular buffer via its Observation Architecture and this patch exposes that capability to userspace via the i915 perf interface. v2: Make sure to initialize ->specific_ctx_id when opening, without relying on _pin_notify hook, in case ctx already pinned. v3: Revert back to pinning ctx upfront when opening stream, removing need to hook in to pinning and to update OACONTROL on the fly.

Robert Bragg committed 10 years ago

Commit d7965151 parent 8a3003d4 files · +1482 −29Browse files

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

Unified · Split

include/uapi/drm/i915_drm.h+69−2
@@ -1230,6 +1230,18 @@ struct drm_i915_gem_context_param { · 1229 unmodified lines
1230 __u64 value;1230 __u64 value;
1231};1231};
1232 1232
1233enum drm_i915_oa_format {
1234 I915_OA_FORMAT_A13 = 1,
1235 I915_OA_FORMAT_A29,
1236 I915_OA_FORMAT_A13_B8_C8,
1237 I915_OA_FORMAT_B4_C8,
1238 I915_OA_FORMAT_A45_B8_C8,
1239 I915_OA_FORMAT_B4_C8_A16,
1240 I915_OA_FORMAT_C4_B8,
1241
1242 I915_OA_FORMAT_MAX /* non-ABI */
1243};
1244
1233enum drm_i915_perf_property_id {1245enum drm_i915_perf_property_id {
1234 /**1246 /**
1235 * Open the stream for a specific context handle (as used with1247 * Open the stream for a specific context handle (as used with
@@ -1238,6 +1250,32 @@ enum drm_i915_perf_property_id { · 2 unmodified lines
1238 */1250 */
1239 DRM_I915_PERF_PROP_CTX_HANDLE = 1,1251 DRM_I915_PERF_PROP_CTX_HANDLE = 1,
1240 1252
1253 /**
1254 * A value of 1 requests the inclusion of raw OA unit reports as
1255 * part of stream samples.
1256 */
1257 DRM_I915_PERF_PROP_SAMPLE_OA,
1258
1259 /**
1260 * The value specifies which set of OA unit metrics should be
1261 * be configured, defining the contents of any OA unit reports.
1262 */
1263 DRM_I915_PERF_PROP_OA_METRICS_SET,
1264
1265 /**
1266 * The value specifies the size and layout of OA unit reports.
1267 */
1268 DRM_I915_PERF_PROP_OA_FORMAT,
1269
1270 /**
1271 * Specifying this property implicitly requests periodic OA unit
1272 * sampling and (at least on Haswell) the sampling frequency is derived
1273 * from this exponent as follows:
1274 *
1275 * 80ns * 2^(period_exponent + 1)
1276 */
1277 DRM_I915_PERF_PROP_OA_EXPONENT,
1278
1241 DRM_I915_PERF_PROP_MAX /* non-ABI */1279 DRM_I915_PERF_PROP_MAX /* non-ABI */
1242};1280};
1243 1281
@@ -1257,7 +1295,23 @@ struct drm_i915_perf_open_param { · 13 unmodified lines
1257 __u64 __user properties_ptr;1295 __u64 __user properties_ptr;
1258};1296};
1259 1297
1298/**
1299 * Enable data capture for a stream that was either opened in a disabled state
1300 * via I915_PERF_FLAG_DISABLED or was later disabled via
1301 * I915_PERF_IOCTL_DISABLE.
1302 *
1303 * It is intended to be cheaper to disable and enable a stream than it may be
1304 * to close and re-open a stream with the same configuration.
1305 *
1306 * It's undefined whether any pending data for the stream will be lost.
1307 */
1260#define I915_PERF_IOCTL_ENABLE _IO('i', 0x0)1308#define I915_PERF_IOCTL_ENABLE _IO('i', 0x0)
1309
1310/**
1311 * Disable data capture for a stream.
1312 *
1313 * It is an error to try and read a stream that is disabled.
1314 */
1261#define I915_PERF_IOCTL_DISABLE _IO('i', 0x1)1315#define I915_PERF_IOCTL_DISABLE _IO('i', 0x1)
1262 1316
1263/**1317/**
@@ -1281,17 +1335,30 @@ enum drm_i915_perf_record_type { · 17 unmodified lines
1281 * every sample.1335 * every sample.
1282 *1336 *
1283 * The order of these sample properties given by userspace has no1337 * The order of these sample properties given by userspace has no
1284 * affect on the ordering of data within a sample. The order will be1338 * affect on the ordering of data within a sample. The order is
1285 * documented here.1339 * documented here.
1286 *1340 *
1287 * struct {1341 * struct {
1288 * struct drm_i915_perf_record_header header;1342 * struct drm_i915_perf_record_header header;
1289 *1343 *
1290 * TODO: itemize extensible sample data here1344 * { u32 oa_report[]; } && DRM_I915_PERF_PROP_SAMPLE_OA
1291 * };1345 * };
1292 */1346 */
1293 DRM_I915_PERF_RECORD_SAMPLE = 1,1347 DRM_I915_PERF_RECORD_SAMPLE = 1,
1294 1348
1349 /*
1350 * Indicates that one or more OA reports were not written by the
1351 * hardware. This can happen for example if an MI_REPORT_PERF_COUNT
1352 * command collides with periodic sampling - which would be more likely
1353 * at higher sampling frequencies.
1354 */
1355 DRM_I915_PERF_RECORD_OA_REPORT_LOST = 2,
1356
1357 /**
1358 * An error occurred that resulted in all pending OA reports being lost.
1359 */
1360 DRM_I915_PERF_RECORD_OA_BUFFER_LOST = 3,
1361
1295 DRM_I915_PERF_RECORD_MAX /* non-ABI */1362 DRM_I915_PERF_RECORD_MAX /* non-ABI */
1296};1363};
1297 1364

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