Unverified Commit 5774b3cf authored by Maíra Canal's avatar Maíra Canal
Browse files

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: default avatarIago Toral Quiroga <itoral@igalia.com>
Link: https://lore.kernel.org/r/20250711-v3d-reset-counter-v1-1-1ac73e9fca2d@igalia.com


Signed-off-by: default avatarMaíra Canal <mcanal@igalia.com>
parent 2650bc40
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -107,6 +107,11 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
	case DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES:
		args->value = !!v3d->gemfs;
		return 0;
	case DRM_V3D_PARAM_GLOBAL_RESET_COUNTER:
		mutex_lock(&v3d->reset_lock);
		args->value = v3d->reset_counter;
		mutex_unlock(&v3d->reset_lock);
		return 0;
	default:
		DRM_DEBUG("Unknown parameter %d\n", args->param);
		return -EINVAL;
+5 −0
Original line number Diff line number Diff line
@@ -196,6 +196,11 @@ struct v3d_dev {
	 * all jobs.
	 */
	struct v3d_perfmon *global_perfmon;

	/* Global reset counter. The counter must be incremented when
	 * a GPU reset happens. It must be protected by @reset_lock.
	 */
	unsigned int reset_counter;
};

static inline struct v3d_dev *
+2 −0
Original line number Diff line number Diff line
@@ -731,6 +731,8 @@ v3d_gpu_reset_for_timeout(struct v3d_dev *v3d, struct drm_sched_job *sched_job)
	/* get the GPU back into the init state */
	v3d_reset(v3d);

	v3d->reset_counter++;

	for (q = 0; q < V3D_MAX_QUEUES; q++)
		drm_sched_resubmit_jobs(&v3d->queue[q].sched);

+1 −0
Original line number Diff line number Diff line
@@ -294,6 +294,7 @@ enum drm_v3d_param {
	DRM_V3D_PARAM_SUPPORTS_CPU_QUEUE,
	DRM_V3D_PARAM_MAX_PERF_COUNTERS,
	DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES,
	DRM_V3D_PARAM_GLOBAL_RESET_COUNTER,
};

struct drm_v3d_get_param {