Native_SDK Vulkan examples run failed

Hello,
In ubuntu18.04 I have built Native_SDK(cmake … -DPVR_WINDOW_SYSTEM=X11) , and all the OpenGLES and OpenCL sample code can run successfully. But all the Vulkan examples are failed to run.

Here is th VulkanHelloAPI running log:

Native_SDK$ ./bin/VulkanHelloAPI 
Host library 'libvulkan.so' loaded
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

INFORMATION: ------------Properties for Physical Devices--------------
INFORMATION: Device Name: Intel(R) UHD Graphics 630 (CML GT2)
INFORMATION: Device ID: 0x9BC8
INFORMATION: Device Driver Version: 0x5402006
INFORMATION: --------------------------------------
INFORMATION: Device Name: llvmpipe (LLVM 12.0.0, 256 bits)
INFORMATION: Device ID: 0x0
INFORMATION: Device Driver Version: 0x1
INFORMATION: --------------------------------------
INFORMATION: Device Name: NVIDIA GeForce GT 730
INFORMATION: Device ID: 0x1287
INFORMATION: Device Driver Version: 0x75AD80C0
INFORMATION: --------------------------------------
INFORMATION: Active Device is -- Intel(R) UHD Graphics 630 (CML GT2)
X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)
  Major opcode of failed request:  149 ()
  Minor opcode of failed request:  4
  Resource id in failed request:  0x4600006
  Serial number of failed request:  37
  Current serial number in output stream:  43

how to fix the error “X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)”

Thanks

Hi slamdunk315,

As a first step, you could check whether you have Vulkan support on your current Linux setup on your machine. Please go to LunarXchange and download the Vulkan SDK. Then please run the vulkaninfo executable to see support and capabilities. Also there is a basic Vulkan application in Bin/vkcube you can try to test if it runs correctly.

After a bit of googling the error you are experiencing X Error of failed request: BadDrawable (invalid Pixmap or Window parameter), I have read several cases seem related with driver version (Invalid pixelmap or window parameter · Issue #2232 · carla-simulator/carla · GitHub). Please try to update both Intel and NVIDIA GPU drivers, and if it does not work, try with older, different versions.

Also it seems the issue could be related with some extensions not available in the GPU being used, which is the Intel one (~eliasnaur/gio#347: examples fail with BadDrawable (invalid Pixmap or Window parameter) — sourcehut todo). You can try running the VulkanHelloAPI demo on the NVIDIA GPU. For that you will need to change code in VulkanHelloAPI::getCompatibleDevice() to force returning as VkPhysicalDevice the other one not being selected.

Let me know if after those tests you still have any issues,

Best regards,
Alejandro

Hi Alejandro,

Thanks for your reply.

Firstly ,I tried Vulkan SDK Bin/vkcube and it runs correctly. So the Vulkan is supported?

Then I change the code like this:
if (deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU )
the ./bin/VulkanHelloAPI runs correctly!

Native_SDK$ ./bin/VulkanHelloAPI 
Host library 'libvulkan.so' loaded
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

INFORMATION: ------------Properties for Physical Devices--------------
INFORMATION: Device Name: Intel(R) UHD Graphics 630 (CML GT2)
INFORMATION: Device ID: 0x9BC8
INFORMATION: Device Driver Version: 0x5402006
INFORMATION: --------------------------------------
INFORMATION: Device Name: llvmpipe (LLVM 12.0.0, 256 bits)
INFORMATION: Device ID: 0x0
INFORMATION: Device Driver Version: 0x1
INFORMATION: --------------------------------------
INFORMATION: Device Name: NVIDIA GeForce GT 730
INFORMATION: Device ID: 0x1287
INFORMATION: Device Driver Version: 0x75AD80C0
INFORMATION: --------------------------------------
INFORMATION: Active Device is -- NVIDIA GeForce GT 730

So the APP runs on NVIDIA GPU correctly.

Another question is ,I find code getCompatibleDevice only located in VulkanHelloAPI.cpp and VulkanIntroducingPVRShell.cpp.

If want to run other samples,maybe modify some other code?

Hi slamdunk315,

Regarding Bin/vkcube it seems Vulkan is supported but I can’t tell whether it was run on you Intel or your NVIDIA GPU.

Good to know you found another way to make VulkanHelloAPI work. Regarding getCompatibleDevice(), we only use it on the VulkanHelloAPI example which is an API introductory example. In our SDK we have our own Vulkan framework used for all other Vulkan examples. I recommend to read VulkanIntroducingPVRShell, VulkanIntroducingPVRUtils and VulkanIntroducingPVRVk examples to understand our framework.

In most of the Vulkan examples in our SDK we select the first physical device found and verify it has all extensions required for the example. You can see in the initView() method in each example code like _deviceResources->instance->getPhysicalDevice(0) with 0 being the index of the physical device chosen. You can change the code to force the NVIDIA GPU. For those demos using ray tracing (HelloRayTracing, HybridHardShadows, HybridReflections, HybridRefractions, HybridSoftShadows, HybridTransparency, RayTracedHardShadows and RayTracingDenoising), we select only the GPU that supports ray tracing at hardware level.

Please let me know if you have any other questions.

Best regards,
Alejandro

Hi Alejandro,

I will take more effort to study SDK sample code.

Thanks very much.