Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://lore.kernel.org/r/20250711-v3d-reset-counter-v1-1-1ac73e9fca2d@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>

+13
+5
drivers/gpu/drm/v3d/v3d_drv.c
··· 107 107 case DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES: 108 108 args->value = !!v3d->gemfs; 109 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 115 default: 111 116 DRM_DEBUG("Unknown parameter %d\n", args->param); 112 117 return -EINVAL;
+5
drivers/gpu/drm/v3d/v3d_drv.h
··· 196 196 * all jobs. 197 197 */ 198 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 206 static inline struct v3d_dev *
+2
drivers/gpu/drm/v3d/v3d_sched.c
··· 731 731 /* get the GPU back into the init state */ 732 732 v3d_reset(v3d); 733 733 734 + v3d->reset_counter++; 735 + 734 736 for (q = 0; q < V3D_MAX_QUEUES; q++) 735 737 drm_sched_resubmit_jobs(&v3d->queue[q].sched); 736 738
+1
include/uapi/drm/v3d_drm.h
··· 294 294 DRM_V3D_PARAM_SUPPORTS_CPU_QUEUE, 295 295 DRM_V3D_PARAM_MAX_PERF_COUNTERS, 296 296 DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES, 297 + DRM_V3D_PARAM_GLOBAL_RESET_COUNTER, 297 298 }; 298 299 299 300 struct drm_v3d_get_param {