diff --git a/src/broadcom/common/v3d_device_info.c b/src/broadcom/common/v3d_device_info.c index fa85a7d5077..ef62a550243 100644 --- a/src/broadcom/common/v3d_device_info.c +++ b/src/broadcom/common/v3d_device_info.c @@ -39,6 +39,9 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i struct drm_v3d_get_param hub_ident3 = { .param = DRM_V3D_PARAM_V3D_HUB_IDENT3, }; + struct drm_v3d_get_param max_perfcnt = { + .param = DRM_V3D_PARAM_MAX_PERF_COUNTERS, + }; int ret; ret = drm_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &ident0); @@ -88,5 +91,15 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i devinfo->rev = (hub_ident3.value >> 8) & 0xff; + ret = drm_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &max_perfcnt); + if (ret != 0) { + /* Kernel doesn't have support to return the maximum number of + * performance counters. + */ + devinfo->max_perfcnt = 0; + } else { + devinfo->max_perfcnt = max_perfcnt.value; + } + return true; } diff --git a/src/broadcom/common/v3d_device_info.h b/src/broadcom/common/v3d_device_info.h index 0df25e8dcce..69b55a9e1eb 100644 --- a/src/broadcom/common/v3d_device_info.h +++ b/src/broadcom/common/v3d_device_info.h @@ -37,6 +37,9 @@ struct v3d_device_info { /** V3D revision number */ uint8_t rev; + /** Maximum number of performance counters for a given V3D version **/ + uint8_t max_perfcnt; + /** Size of the VPM, in bytes. */ int vpm_size;