History

drm/v3d: Add parameter to retrieve the global number of GPU resets

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.

Maíra Canal committed 1 year ago

Commit 5774b3c1 parent 2650bc44 files · +13 −0Browse files

Unified · Split

4 files
  1. drivers/gpu/drm/v3d/v3d_drv.c +5 −0
  2. drivers/gpu/drm/v3d/v3d_drv.h +5 −0
  3. drivers/gpu/drm/v3d/v3d_sched.c +2 −0
  4. include/uapi/drm/v3d_drm.h +1 −0
drivers/gpu/drm/v3d/v3d_drv.c+5−0
@@ -107,6 +107,11 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data, · 106 unmodified lines
107107 case DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES:
108108 args->value = !!v3d->gemfs;
109109 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;
110115 default:
111116 DRM_DEBUG("Unknown parameter %d\n", args->param);
112117 return -EINVAL;
drivers/gpu/drm/v3d/v3d_drv.h+5−0
@@ -196,6 +196,11 @@ struct v3d_dev { · 195 unmodified lines
196196 * all jobs.
197197 */
198198 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;
199204 };
200205
201206 static inline struct v3d_dev *
drivers/gpu/drm/v3d/v3d_sched.c+2−0
@@ -731,6 +731,8 @@ v3d_gpu_reset_for_timeout(struct v3d_dev *v3d, struct drm_sched_job *sched_job) · 730 unmodified lines
731731 /* get the GPU back into the init state */
732732 v3d_reset(v3d);
733733
734+ v3d->reset_counter++;
735+
734736 for (q = 0; q < V3D_MAX_QUEUES; q++)
735737 drm_sched_resubmit_jobs(&v3d->queue[q].sched);
736738
include/uapi/drm/v3d_drm.h+1−0
@@ -294,6 +294,7 @@ enum drm_v3d_param { · 293 unmodified lines
294294 DRM_V3D_PARAM_SUPPORTS_CPU_QUEUE,
295295 DRM_V3D_PARAM_MAX_PERF_COUNTERS,
296296 DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES,
297+ DRM_V3D_PARAM_GLOBAL_RESET_COUNTER,
297298 };
298299
299300 struct drm_v3d_get_param {