broadcom/common: Add maximum number of perf counters to v3d_device_info
Now, the kernel has the ability to inform about the maximum number of performance counters of a V3D device. Let's add this information to the `struct v3d_device_info` to use it when performing performance queries. From now on, V3D_PERFCNT_NUM must not be used to retrieve the maximum number of performance counters. We must use `devinfo->max_perfcnt`, except on the case that the kernel doesn't support DRM_V3D_PARAM_MAX_PERF_COUNTERS. Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29154>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user