Vulkan API returns VK_ERROR_INCOMPATIBLE_DRIVER (-9)

Hello,

I rebuilt the linux Yocto project, starting from latest of branch LinuxImage3.0. I created my own image “requiring” the console-tdx-image and adding vulkan into it (IMAGE_INSTALL+=vulkan). I then created the SDK associated with this image.

I can then create and compile and run on target an application (c++) which is using vulkan and doing the first following elementary steps of the vulkan API initialization:

const VkApplicationInfo applicationInfo = {
    VK_STRUCTURE_TYPE_APPLICATION_INFO,
    0,
    "Test",
    0,
    "",
    0,
    VK_MAKE_VERSION(1, 0, 0)
  };

  const VkInstanceCreateInfo instanceCreateInfo = {
    VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
    0,
    0,
    &applicationInfo,
    0,
    0,
    0,
    0
  };

  VkInstance instance;
  std::cout << vkCreateInstance(&instanceCreateInfo, 0, &instance) << std::endl;

The vkCreateInstance call returns the error code VK_ERROR_INCOMPATIBLE_DRIVER (-9). Any idea why ? I checked and the image does contain the recipe “imx-gpu-viv” so I’m assuming it is using the VIVANTE GPU driver ? And the I.mx8 is supposed to support vulkan (at least this is what NXP claims on their website). Note (if that could make any difference) that I’m launching the application from a shell over ssh… (But I think that should not be a problem…)

Hi

Note that we are not the experts on Vulkan, so take the following with a grain of salt.

I assume you linked against the Vulkan loader, i.e. /usr/lib/libvulkan.so.1.1.73 to get the driver into your binary. That loader can then search and call the vendor driver for the platform your on.
The BSP currently does not install a file which allows the loader to find the installed platform drivers, You could try to create that file for the Vivante driver.

i.e. create a file /etc/vulkan/icd.d/vivante.json with the following content:

{
   "file_format_version": "1.0.0",
   "ICD": {
      "library_path": "/usr/lib/vulkan/libvulkan_VSI.so",
      "api_version": "1.0.59"
   }
}

With the package ‘vulkan-demos’ installed in the image and that file created I could run the demos, i.e. ‘triangle’.

Max

Hello @max.tx

Thanks for the answer. No problem, I’m not an expert either in vulkan nor in linux so … :wink:

You are correct, I link against “libvulkan.so.1.1.73”.

I noticed my yocto built image does not contain the lib “/usr/lib/vulkan/libvulkan_VSI.so” . Any idea what I should modify in my yocto project to get that in the image ? I started from the “console-tdx-image” and added “IMAGE_INSTALL+=vulkan” to get the vulkan loader libs in (which I do have); and in my local.conf file I set MACHINE ?= “apalis-imx8”. those are pretty much the only changes I made… Note I’m on the yocto bsp 3.0b4.

You will need for sure a graphical backend, for Apalis iMX8 the only choice is weston. And you will need the Vivante GPU drivers.

I built the qt5-x11-image to which I only needed to add vulkan-demos to get the demos running.

If you want to add on top of console-tdx-image I would expect the following to be enough:
'IMAGE_INSTALL+=“weston weston-init vulkan libvulkan-imx” ’
maybe additionally vulkan-bin which would provide vulkaninfo, likely one of the most basic vulkan use cases.

Max

thanks for your help @max.tx, I now have vulkaninfo working and also vkCreateInstance in my application returns success… So far so good, I can now continue with the next steps :slight_smile:
Thanks again.

Perfect that it works. Thanks for your feedback.