From: Iago Toral Quiroga Date: Tue, 9 Nov 2021 07:50:51 +0000 (+0100) Subject: broadcom/common: retrieve V3D revision number X-Git-Tag: upstream/23.3.3~929 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04f16574e66a150a012a42b45620b910ef0b544e;p=platform%2Fupstream%2Fmesa.git broadcom/common: retrieve V3D revision number The subrev field from the hub ident3 register is bumped with every hardware revision doing backwards incompatible changes so we want to keep track of this. Instead of modifying the 'ver' field info to acommodate subrev info, which would require a lot of changes, simply add a new 'rev' field in devinfo that we can use when we need to make changes based on the revision number of a hardware release. Reviewed-by: Alejandro PiƱeiro Part-of: --- diff --git a/src/broadcom/common/v3d_device_info.c b/src/broadcom/common/v3d_device_info.c index 7e0862f..7512fe3 100644 --- a/src/broadcom/common/v3d_device_info.c +++ b/src/broadcom/common/v3d_device_info.c @@ -36,6 +36,9 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i struct drm_v3d_get_param ident1 = { .param = DRM_V3D_PARAM_V3D_CORE0_IDENT1, }; + struct drm_v3d_get_param hub_ident3 = { + .param = DRM_V3D_PARAM_V3D_HUB_IDENT3, + }; int ret; ret = drm_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &ident0); @@ -76,5 +79,14 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i return false; } - return true; + ret = drm_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &hub_ident3); + if (ret != 0) { + fprintf(stderr, "Couldn't get V3D core HUB IDENT3: %s\n", + strerror(errno)); + return false; + } + + devinfo->rev = (hub_ident3.value >> 8) & 0xff; + + return true; } diff --git a/src/broadcom/common/v3d_device_info.h b/src/broadcom/common/v3d_device_info.h index 97abd9b..32cb65c 100644 --- a/src/broadcom/common/v3d_device_info.h +++ b/src/broadcom/common/v3d_device_info.h @@ -34,6 +34,9 @@ struct v3d_device_info { /** Simple V3D version: major * 10 + minor */ uint8_t ver; + /** V3D revision number */ + uint8_t rev; + /** Size of the VPM, in bytes. */ int vpm_size;