The GL extension KHR_robustness uses the number of global and per-context GPU resets to learn about graphics resets that affect a GL context. This commit introduces a new V3D parameter to retrieve the global number of GPU resets that have happened since the driver was probed. To retrieve this information, user-space must use DRM_V3D_PARAM_GLOBAL_RESET_COUNTER.
Unified · Split
| @@ -107,6 +107,11 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data, · 106 unmodified lines | |||
| 107 | case DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES: | 107 | case DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES: |
| 108 | args->value = !!v3d->gemfs; | 108 | args->value = !!v3d->gemfs; |
| 109 | return 0; | 109 | return 0; |
| 110 | case DRM_V3D_PARAM_GLOBAL_RESET_COUNTER: | ||
| 111 | mutex_lock(&v3d->reset_lock); | ||
| 112 | args->value = v3d->reset_counter; | ||
| 113 | mutex_unlock(&v3d->reset_lock); | ||
| 114 | return 0; | ||
| 110 | default: | 115 | default: |
| 111 | DRM_DEBUG("Unknown parameter %d\n", args->param); | 116 | DRM_DEBUG("Unknown parameter %d\n", args->param); |
| 112 | return -EINVAL; | 117 | return -EINVAL; |
| @@ -196,6 +196,11 @@ struct v3d_dev { · 195 unmodified lines | |||
| 196 | * all jobs. | 196 | * all jobs. |
| 197 | */ | 197 | */ |
| 198 | struct v3d_perfmon *global_perfmon; | 198 | struct v3d_perfmon *global_perfmon; |
| 199 | |||
| 200 | /* Global reset counter. The counter must be incremented when | ||
| 201 | * a GPU reset happens. It must be protected by @reset_lock. | ||
| 202 | */ | ||
| 203 | unsigned int reset_counter; | ||
| 199 | }; | 204 | }; |
| 200 | 205 | ||
| 201 | static inline struct v3d_dev * | 206 | static inline struct v3d_dev * |
| @@ -731,6 +731,8 @@ v3d_gpu_reset_for_timeout(struct v3d_dev *v3d, struct drm_sched_job *sched_job) · 730 unmodified lines | |||
| 731 | /* get the GPU back into the init state */ | 731 | /* get the GPU back into the init state */ |
| 732 | v3d_reset(v3d); | 732 | v3d_reset(v3d); |
| 733 | 733 | ||
| 734 | v3d->reset_counter++; | ||
| 735 | |||
| 734 | for (q = 0; q < V3D_MAX_QUEUES; q++) | 736 | for (q = 0; q < V3D_MAX_QUEUES; q++) |
| 735 | drm_sched_resubmit_jobs(&v3d->queue[q].sched); | 737 | drm_sched_resubmit_jobs(&v3d->queue[q].sched); |
| 736 | 738 | ||
| @@ -294,6 +294,7 @@ enum drm_v3d_param { · 293 unmodified lines | |||
| 294 | DRM_V3D_PARAM_SUPPORTS_CPU_QUEUE, | 294 | DRM_V3D_PARAM_SUPPORTS_CPU_QUEUE, |
| 295 | DRM_V3D_PARAM_MAX_PERF_COUNTERS, | 295 | DRM_V3D_PARAM_MAX_PERF_COUNTERS, |
| 296 | DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES, | 296 | DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES, |
| 297 | DRM_V3D_PARAM_GLOBAL_RESET_COUNTER, | ||
| 297 | }; | 298 | }; |
| 298 | 299 | ||
| 299 | struct drm_v3d_get_param { | 300 | struct drm_v3d_get_param { |