Linux DisplayKHR enumeration takes a really long time

On Ubuntu 20 I’m measuring vkGetPhysicalDeviceDisplayPropertiesKHR takes 2.783 seconds.

What impacts this time? If I directly initialize with DRM API calls it’s a fraction of the same time, even with reading and parsing EDID for each display.

Any way to speed this up?

This call takes about the same time vkGetPhysicalDeviceDisplayPlanePropertiesKHR. Everything else is quick.

Not sure what Vk drivers you’re running, but…

Since you’re on Linux, you might try running strace on your process. This to see what kernel calls are being made during that huge 2.782 second interval!

For instance:

strace myapp

By default, logs to the console. Redirect the output to a file for later perusal.

That’s a good idea. I’ll try that.

I added validation with all the spew. Looks like a timeout/retry is happening. There is no swapchain at this point in the code.

[drmpp] [debug] Vendor ID 0x8086, device name Intel(R) UHD Graphics (TGL GT1)
[drmpp] [debug] Device ID 0x9A60
[drmpp] [debug] Driver Version: 24.3.0
[drmpp] [debug] API Version: 1.3.296
[drmpp] [debug] Pipeline Cache UUID: a2b5c233-09a8-d84e-ab6d-afbad02b498e
[drmpp] [debug] Type: Integrated GPU
[drmpp] [debug] Display:
[drmpp] [debug] 	name: monitor
[drmpp] [debug] 	physical dimensions: 508x286
[drmpp] [debug] 	physical resolution: 1920x1080
[drmpp] [debug] 	plane reorder: no
[drmpp] [debug] 	persistent content: no
[drmpp] [debug] 	supported transforms: 1
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
[drmpp] [debug] Modes for display (monitor)
[drmpp] [debug] 	1920x1080 @60.003
[drmpp] [debug] 	1920x1080 @48.004
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
[drmpp] [debug] Found Plane: Index: 0, Stack Index: 0
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
[drmpp] [debug] Found Plane: Index: 1, Stack Index: 0
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
[drmpp] [debug] Found Plane: Index: 2, Stack Index: 0
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
[drmpp] [debug] Found Plane: Index: 3, Stack Index: 0
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
[drmpp] [debug] Found Plane: Index: 4, Stack Index: 0
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
[drmpp] [debug] Found Plane: Index: 5, Stack Index: 0
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
[drmpp] [debug] Found Plane: Index: 6, Stack Index: 0
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkSwapchainKHR Object 0x10000000001. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x10000000001, type: 1000002000, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkDisplayKHR Object 0x40000000004. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x40000000004, type: 1000002001, name: NULL
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 0 - Couldn't find VkDisplayKHR Object 0x40000000004. This should not happen and may indicate a bug in the application.
    Objects: 1
        [0] 0x40000000004, type: 1000002001, name: NULL
[drmpp] [debug]    src pos: min: 0,0 -> max: 0,0
[drmpp] [debug]    src size: min: 1920,1080-> max: 1920,1080
[drmpp] [debug]    dst pos: min: 0,0 -> max: 0,0
[drmpp] [debug]    dst size: min: 1920,1080 -> max: 1920,1080
[drmpp] [warning] Protected memory requested but not supported by device

Fedora 41 different complaint; no delay. Only an issue on Ubuntu 20.

Code for those interested: