Expose timestamp information supported by the GPU with a new device query. Mali uses an external timer as GPU system time. On ARM, this is wired to the generic arch timer so we wire cntfrq_el0 as device frequency. This new uAPI will be used in Mesa to implement timestamp queries and VK_KHR_calibrated_timestamps. Since this extends the uAPI and because userland needs a way to advertise those features conditionally, this also bumps the driver minor version. v2: - Rewrote to use GPU timestamp register - Added timestamp_offset to drm_panthor_timestamp_info - Add missing include for arch_timer_get_cntfrq - Rework commit message v3: - Add panthor_gpu_read_64bit_counter - Change panthor_gpu_read_timestamp to use panthor_gpu_read_64bit_counter v4: - Fix multiple typos in uAPI documentation - Mention behavior when the timestamp frequency is unknown - Use u64 instead of unsigned long long for panthor_gpu_read_timestamp - Apply r-b from Mihail
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -260,6 +260,9 @@ enum drm_panthor_dev_query_type { · 259 unmodified lines | ||
| 260 | 260 | |
| 261 | 261 | /** @DRM_PANTHOR_DEV_QUERY_CSIF_INFO: Query command-stream interface information. */ |
| 262 | 262 | DRM_PANTHOR_DEV_QUERY_CSIF_INFO, |
| 263 | + | |
| 264 | + /** @DRM_PANTHOR_DEV_QUERY_TIMESTAMP_INFO: Query timestamp information. */ | |
| 265 | + DRM_PANTHOR_DEV_QUERY_TIMESTAMP_INFO, | |
| 263 | 266 | }; |
| 264 | 267 | |
| 265 | 268 | /** |
| @@ -377,6 +380,25 @@ struct drm_panthor_csif_info { · 111 unmodified lines | ||
| 377 | 380 | __u32 pad; |
| 378 | 381 | }; |
| 379 | 382 | |
| 383 | +/** | |
| 384 | + * struct drm_panthor_timestamp_info - Timestamp information | |
| 385 | + * | |
| 386 | + * Structure grouping all queryable information relating to the GPU timestamp. | |
| 387 | + */ | |
| 388 | +struct drm_panthor_timestamp_info { | |
| 389 | + /** | |
| 390 | + * @timestamp_frequency: The frequency of the timestamp timer or 0 if | |
| 391 | + * unknown. | |
| 392 | + */ | |
| 393 | + __u64 timestamp_frequency; | |
| 394 | + | |
| 395 | + /** @current_timestamp: The current timestamp. */ | |
| 396 | + __u64 current_timestamp; | |
| 397 | + | |
| 398 | + /** @timestamp_offset: The offset of the timestamp timer. */ | |
| 399 | + __u64 timestamp_offset; | |
| 400 | +}; | |
| 401 | + | |
| 380 | 402 | /** |
| 381 | 403 | * struct drm_panthor_dev_query - Arguments passed to DRM_PANTHOR_IOCTL_DEV_QUERY |
| 382 | 404 | */ |