vulkan/wsi/display: set pDisplay to NULL on error
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 4 Apr 2023 10:25:11 +0000 (12:25 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 5 Apr 2023 06:21:26 +0000 (06:21 +0000)
commit1bbbdbe6663a582150aff05f78f4b7ce36c69ce8
tree247c37e43c5e4aa3b32ae14d8572cd2545947e23
parentd28cf0dbd5f9681dd654342623bab503c289beb5
vulkan/wsi/display: set pDisplay to NULL on error

the spec for vkGetDrmDisplayEXT says:

  "If there is no VkDisplayKHR corresponding to the connectorId on the
   physicalDevice, the returning display must be set to VK_NULL_HANDLE.
   The provided drmFd must correspond to the one owned by the physicalDevice.
   If not, the error code VK_ERROR_UNKNOWN must be returned. (...)
   The given connectorId must be a resource owned by the provided drmFd.
   If not, the error code VK_ERROR_UNKNOWN must be returned"

We were only setting the display pointer to VK_NULL_HANDLE if the provided
drmFd was valid, however, there are CTS tests checking that it is also set
to NULL when it is not.

Fixes the following test on all drivers exposing EXT_acquire_drm_display
(tested with Intel and V3DV):
dEQP-VK.wsi.acquire_drm_display.acquire_drm_display_invalid_fd

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22283>
src/vulkan/wsi/wsi_common_display.c