From: Iago Toral Quiroga Date: Tue, 26 May 2020 06:38:31 +0000 (+0200) Subject: v3dv: check that GPU device matches requirements X-Git-Tag: upstream/21.0.0~3943 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45af2016f3fddcdb1bcce21c636896511c832bc6;p=platform%2Fupstream%2Fmesa.git v3dv: check that GPU device matches requirements Part-of: --- diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 52775ba..d0545aa 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -323,6 +323,25 @@ create_display_fd_xcb() #endif #endif +static bool +v3d_has_feature(struct v3dv_physical_device *device, enum drm_v3d_param feature) +{ + struct drm_v3d_get_param p = { + .param = feature, + }; + if (v3dv_ioctl(device->render_fd, DRM_IOCTL_V3D_GET_PARAM, &p) != 0) + return false; + return p.value; +} + +static bool +device_has_expected_features(struct v3dv_physical_device *device) +{ + return v3d_has_feature(device, DRM_V3D_PARAM_SUPPORTS_TFU) && + v3d_has_feature(device, DRM_V3D_PARAM_SUPPORTS_CSD) && + v3d_has_feature(device, DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH); +} + static VkResult physical_device_init(struct v3dv_physical_device *device, struct v3dv_instance *instance, @@ -368,6 +387,16 @@ physical_device_init(struct v3dv_physical_device *device, goto fail; } + if (device->devinfo.ver < 42) { + result = VK_ERROR_INCOMPATIBLE_DRIVER; + goto fail; + } + + if (!device_has_expected_features(device)) { + result = VK_ERROR_INCOMPATIBLE_DRIVER; + goto fail; + } + device->compiler = v3d_compiler_init(&device->devinfo); device->next_program_id = 0;