hanatos / vkdt

raw photography workflow that sucks less
https://jo.dreggn.org/vkdt
BSD 2-Clause "Simplified" License
378 stars 35 forks source link

Failed to start with debug build on AMD Radeon RX 6700 XT (RADV NAVI22) #111

Closed dydyamotya closed 7 months ago

dydyamotya commented 8 months ago

Hello. Just've built debug version of vkdt.

I'm trying to start application with -d all flag and path to .RW2 file. And failing.

These are log messages:


[pipe] base directory /home/motya/packages/vkdt/bin
[pipe] home directory /home/motya/.config/vkdt
[pipe] loaded 76 modules
[gui] glfwGetVersionString() : 3.3.9 Wayland EGL OSMesa clock_gettime evdev shared
[gui] monitor [0] DP-1 at 0 0
[gui] monitor [1] DP-2 at 0 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_KHR_wayland_surface
[qvk] validation layer: Copying old device 0 into new device 0
[qvk] validation layer: Copying old device 0 into new device 0
[qvk] dev 0: vendorid 0x1002
[qvk] dev 0: AMD Radeon RX 6700 XT (RADV NAVI22)
[qvk] max number of allocations -1
[qvk] max image allocation size 16384 x 16384
[qvk] max uniform buffer range 4294967295
[qvk] num queue families: 2
[qvk] picked device 0 with ray tracing and without float atomics and without coopmat support
[qvk] validation layer: vkCreateDevice extension VK_EXT_debug_marker not available for devices associated with ICD /usr/lib/libvulkan_radeon.so
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[gui] found joystick A4TECH USB Device Keyboard
[gui] disabling joystick due to explicit config request. enable by
[gui] setting 'intgui/disable_joystick:0' in ~/.config/vkdt/config.rc
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[db] allocating 1024.0 MB for thumbnails
[perf] upload source total:    0.035 ms
[perf] create raytrace accel:      0.000 ms
[perf] record command buffer:      0.090 ms
[mem] images : peak rss 0.00390625 MB vmsize 0.00390625 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 0.000244141 MB vmsize 0.000244141 MB
[perf] record cmd buffer:      1.166 ms
[perf] i-bc1    main    :      0.016 ms
[perf] total time:     0.016 ms
[perf] [thm] ran graph in   2ms
[perf] upload source total:    0.283 ms
[perf] create raytrace accel:      0.000 ms
[perf] record command buffer:      0.041 ms
[mem] images : peak rss 0.078125 MB vmsize 0.078125 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 0.114441 MB vmsize 0.114441 MB
[perf] record cmd buffer:      0.856 ms
[perf] i-bc1    main    :      0.019 ms
[perf] total time:     0.019 ms
[perf] [thm] ran graph in   1ms
[perf] [rawspeed] load /home/motya/packages/vkdt/P1015571.RW2 in 2256ms
[perf] upload source total:    9.342 ms
[perf] create raytrace accel:      0.000 ms
[qvk] validation layer: Validation Error: [ VUID-vkCmdDispatch-format-07753 ] Object 0: handle = 0x178dbb0000000eff, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0x6d5c6c0000000df9, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0x6714bd0c | vkCmdDispatch():  the descriptor (VkDescriptorSet 0x178dbb0000000eff[], binding 3, index 0) requires UINT component type, but bound descriptor format is VK_FORMAT_R16G16B16A16_SFLOAT. The Vulkan spec states: If a VkImageView is accessed as a result of this command, then the numeric type of the image view's format and the Sampled Type operand of the OpTypeImage must match (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDispatch-format-07753)
[pipe] base directory /home/motya/packages/vkdt/bin
[pipe] home directory /home/motya/.config/vkdt
[pipe] loaded 76 modules
[gui] glfwGetVersionString() : 3.3.9 Wayland EGL OSMesa clock_gettime evdev shared
[gui] monitor [0] DP-1 at 0 0
[gui] monitor [1] DP-2 at 0 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_KHR_wayland_surface
[qvk] validation layer: Copying old device 0 into new device 0
[qvk] validation layer: Copying old device 0 into new device 0
[qvk] dev 0: vendorid 0x1002
[qvk] dev 0: AMD Radeon RX 6700 XT (RADV NAVI22)
[qvk] max number of allocations -1
[qvk] max image allocation size 16384 x 16384
[qvk] max uniform buffer range 4294967295
[qvk] num queue families: 2
[qvk] picked device 0 with ray tracing and without float atomics and without coopmat support
[qvk] validation layer: vkCreateDevice extension VK_EXT_debug_marker not available for devices associated with ICD /usr/lib/libvulkan_radeon.so
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[gui] found joystick A4TECH USB Device Keyboard
[gui] disabling joystick due to explicit config request. enable by
[gui] setting 'intgui/disable_joystick:0' in ~/.config/vkdt/config.rc
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[db] allocating 1024.0 MB for thumbnails
[perf] upload source total:    0.035 ms
[perf] create raytrace accel:      0.000 ms
[perf] record command buffer:      0.090 ms
[mem] images : peak rss 0.00390625 MB vmsize 0.00390625 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 0.000244141 MB vmsize 0.000244141 MB
[perf] record cmd buffer:      1.166 ms
[perf] i-bc1    main    :      0.016 ms
[perf] total time:     0.016 ms
[perf] [thm] ran graph in   2ms
[perf] upload source total:    0.283 ms
[perf] create raytrace accel:      0.000 ms
[perf] record command buffer:      0.041 ms
[mem] images : peak rss 0.078125 MB vmsize 0.078125 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 0.114441 MB vmsize 0.114441 MB
[perf] record cmd buffer:      0.856 ms
[perf] i-bc1    main    :      0.019 ms
[perf] total time:     0.019 ms
[perf] [thm] ran graph in   1ms
[perf] [rawspeed] load /home/motya/packages/vkdt/P1015571.RW2 in 2256ms
[perf] upload source total:    9.342 ms
[perf] create raytrace accel:      0.000 ms
[qvk] validation layer: Validation Error: [ VUID-vkCmdDispatch-format-07753 ] Object 0: handle = 0x178dbb0000000eff, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0x6d5c6c0000000df9, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0x6714bd0c | vkCmdDispatch():  the descriptor (VkDescriptorSet 0x178dbb0000000eff[], binding 3, index 0) requires UINT component type, but bound descriptor format is VK_FORMAT_R16G16B16A16_SFLOAT. The Vulkan spec states: If a VkImageView is accessed as a result of this command, then the numeric type of the image view's format and the Sampled Type operand of the OpTypeImage must match (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDispatch-format-07753)

Is it a problem of GPU driver? I'll try to debug using db as far as I could later.

Thanks for any help.

hanatos commented 8 months ago

heya,

is that with current master?

my first guess is this is because your gpu does not support floating point atomics, so i'm doing some uint/float cast things. i thought i had fixed all these though, and also if you're using the default pipeline there shouldn't be any atomics in it.

are you comfortable with gdb to find out which module it is (use something like p dt_token_print(module->name))? the other guess i have is that the output of the i-raw module is strictly speaking ui16 but the texture is sometimes bound as f16 by later modules (the gpu texture units abstract this format).

maybe you could also disable debug (or at least the validation layers in the toplevel makefile, so it runs) and then open the node graph editor (ctrl-n in darkroom mode). then hover over the connectors of i-raw and denoise etc to find the channel configuration and pixel format used there. ideally i-raw would output rggb:ui16 and denoise would take the same as input (in particular not something mismatching like rgba:f16.

dydyamotya commented 8 months ago

Yeah, master branch.

This log line supports your first guess:

picked device 0 with ray tracing and without float atomics and without coopmat support

If I've setup everything correct for gdb the name of module->name is colour.

Checked after that with straightforward way (print is code):

token: denoise
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: demosaic
token: demosaic
token: demosaic
token: demosaic
token: crop
token: colour
[qvk] validation layer: Validation Error: [ VUID-vkCmdDispatch-format-07753 ] Object 0: handle = 0x178dbb0000000eff, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0x6d5c6c0000000df9, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0x6714bd0c | vkCmdDispatch():  the descriptor (VkDescriptorSet 0x178dbb0000000eff[], binding 3, index 0) requires UINT component type, but bound descriptor format is VK_FORMAT_R16G16B16A16_SFLOAT. The Vulkan spec states: If a VkImageView is accessed as a result of this command, then the numeric type of the image view's format and the Sampled Type operand of the OpTypeImage must match (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDispatch-format-07753)
vkdt: qvk/qvk.c:102: VkBool32 vk_debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT *, void *): Assertion `0' failed.
dydyamotya commented 8 months ago

Have disabled validation layers with deleting: -DQVK_ENABLE_VALIDATION from vkdt/Makefile probably.

Now it propagates to this piece of log:

token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: hilite
token: demosaic
token: demosaic
token: crop
token: colour
token: filmcurv
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: llap
token: f2srgb
[perf] record command buffer:      0.446 ms
[mem] images : peak rss 290.672 MB vmsize 310.062 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 39.6201 MB vmsize 39.6201 MB
[perf] record cmd buffer:    244.032 ms
[qvk] error VK_ERROR_INITIALIZATION_FAILED executing qvk_submit(graph->queue, 1, &submit, graph->command_fence[f])!
[db] [thm] running the thumbnail graph failed on image '/home/motya/packages/vkdt/P1015571.RW2.cfg'!
hanatos commented 8 months ago

VK_ERROR_INITIALIZATION_FAILED <= did you already close the window/shutdown the program when this happened? there's a chance that during teardown of the threads this will be the result.

anyways thanks for the additional output! i believe it is the atomics and how the img_pick (binding 3 in colour/main.comp) is bound. probably need to connect a different dummy cpu side in case there is no colour picker attached in colour/main.c.

dydyamotya commented 8 months ago

The program closed itself with this error.

Now i've tried to launch it again and now it doesn't really halt, but I can't see any output.

This is the log:

[pipe] base directory /home/motya/packages/vkdt/bin
[pipe] home directory /home/motya/.config/vkdt
[pipe] loaded 76 modules
[gui] glfwGetVersionString() : 3.3.9 Wayland EGL OSMesa clock_gettime evdev shared
[gui] monitor [0] DP-1 at 0 0
[gui] monitor [1] DP-2 at 0 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_KHR_wayland_surface
[qvk] validation layer: Copying old device 0 into new device 0
[qvk] dev 0: vendorid 0x1002
[qvk] dev 0: AMD Radeon RX 6700 XT (RADV NAVI22)
[qvk] max number of allocations -1
[qvk] max image allocation size 16384 x 16384
[qvk] max uniform buffer range 4294967295
[qvk] num queue families: 2
[qvk] picked device 0 with ray tracing and without float atomics and without coopmat support
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[gui] found joystick A4TECH USB Device Keyboard
[gui] disabling joystick due to explicit config request. enable by
[gui] setting 'intgui/disable_joystick:0' in ~/.config/vkdt/config.rc
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[db] allocating 1024.0 MB for thumbnails
[perf] upload source total:    0.024 ms
[perf] create raytrace accel:      0.000 ms
[perf] record command buffer:      0.024 ms
[mem] images : peak rss 0.00390625 MB vmsize 0.00390625 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 0.000244141 MB vmsize 0.000244141 MB
[perf] record cmd buffer:      0.611 ms
[perf] i-bc1    main    :      0.017 ms
[perf] total time:     0.017 ms
[perf] [thm] ran graph in   1ms
[perf] upload source total:    0.285 ms
[perf] create raytrace accel:      0.000 ms
[perf] record command buffer:      0.011 ms
[mem] images : peak rss 0.078125 MB vmsize 0.078125 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 0.114441 MB vmsize 0.114441 MB
[perf] record cmd buffer:      0.737 ms
[perf] i-bc1    main    :      0.019 ms
[perf] total time:     0.019 ms
[perf] [thm] ran graph in   1ms
[perf] [rawspeed] load /home/motya/packages/vkdt/P1015571.RW2 in 2224ms
[perf] upload source total:    9.484 ms
[perf] create raytrace accel:      0.000 ms
[perf] record command buffer:      0.309 ms
[mem] images : peak rss 820.938 MB vmsize 856.25 MB
[mem] buffers: peak rss 0 MB vmsize 0 MB
[mem] staging: peak rss 197.969 MB vmsize 197.969 MB
[perf] record cmd buffer:    238.261 ms
[perf] i-raw    main    :      1.741 ms
[perf] denoise  noop    :      1.029 ms
[perf] hilite   half    :      0.564 ms
[perf] hilite   reduce  :      2.859 ms
[perf] hilite   reduce  :      0.720 ms
[perf] hilite   reduce  :      0.185 ms
[perf] hilite   reduce  :      0.040 ms
[perf] hilite   reduce  :      0.027 ms
[perf] hilite   reduce  :      0.024 ms
[perf] hilite   reduce  :      0.024 ms
[perf] hilite   reduce  :      0.023 ms
[perf] hilite   reduce  :      0.021 ms
[perf] hilite   reduce  :      0.021 ms
[perf] hilite   assemble:      0.007 ms
[perf] hilite   assemble:      0.008 ms
[perf] hilite   assemble:      0.007 ms
[perf] hilite   assemble:      0.007 ms
[perf] hilite   assemble:      0.008 ms
[perf] hilite   assemble:      0.012 ms
[perf] hilite   assemble:      0.031 ms
[perf] hilite   assemble:      0.111 ms
[perf] hilite   assemble:      0.419 ms
[perf] hilite   assemble:      1.653 ms
[perf] hilite   doub    :      1.331 ms
[perf] sum hilite:     8.103 ms
[perf] demosaic down    :      0.261 ms
[perf] demosaic gauss   :      1.213 ms
[perf] demosaic splat   :      1.052 ms
[perf] demosaic fix     :      2.978 ms
[perf] sum demosaic:       5.505 ms
[perf] crop     main    :      0.820 ms
[perf] colour   main-   :      0.974 ms
[perf] filmcurv main    :      0.994 ms
[perf] llap     curve   :      2.756 ms
[perf] llap     reduce  :      1.889 ms
[perf] llap     reduce  :      0.434 ms
[perf] llap     reduce  :      0.089 ms
[perf] llap     reduce  :      0.014 ms
[perf] llap     reduce  :      0.004 ms
[perf] llap     reduce  :      0.002 ms
[perf] llap     reduce  :      0.001 ms
[perf] llap     reduce  :      0.001 ms
[perf] llap     reduce  :      0.001 ms
[perf] llap     reduce  :      0.001 ms
[perf] llap     reduce  :      0.001 ms
[perf] llap     assemble:      0.007 ms
[perf] llap     assemble:      0.008 ms
[perf] llap     assemble:      0.007 ms
[perf] llap     assemble:      0.006 ms
[perf] llap     assemble:      0.004 ms
[perf] llap     assemble:      0.007 ms
[perf] llap     assemble:      0.014 ms
[perf] llap     assemble:      0.036 ms
[perf] llap     assemble:      0.130 ms
[perf] llap     assemble:      0.547 ms
[perf] llap     assemble:      2.409 ms
[perf] llap     colour  :      0.923 ms
[perf] sum llap:       9.308 ms
[perf] hist     collect :      2.075 ms
[perf] hist     map     :      0.009 ms
[perf] total time:    37.188 ms
[perf] fps 2.9e+03
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[perf] fps 19
[perf] fps 4.7e+02
[perf] fps 4.3e+03

I see that some window is created for a moment (like a flicker) and than destroyed immediately. But program after that is running eating 100% CPU on one core.

dydyamotya commented 8 months ago

I found out that something happens here (gui/main.c:326):

  while(!glfwWindowShouldClose(qvk.window))
  {
    // block and wait for one event instead of polling all the time to save on
    // gpu workload. might need an interrupt for "render finished" etc. we might
    // do that via glfwPostEmptyEvent()
    if(vkdt.wstate.busy > 0) vkdt.wstate.busy--;
    // vkdt.wstate.busy = 100; // do these two lines instead if profiling in nvidia gfx insight or so.
    // vkdt.graph_dev.runflags = s_graph_run_record_cmd_buf;
    if(vkdt.state.anim_playing) // should redraw because animation is playing?
      vkdt.wstate.busy = vkdt.state.anim_max_frame == -1 ? 3 : vkdt.state.anim_max_frame - vkdt.state.anim_frame + 1;
    if(vkdt.wstate.busy > 0) glfwPostEmptyEvent();
    else vkdt.wstate.busy = 3;

    glfwWaitEvents(); <--------------

    for(int i=0;i<100;i++) if(!qvk_sub_work()) break;

On the first cycle (or second) the window is created. I can see the photo.

After one or two cycles more window disappers and after that program holds on the glfwWaitEvents() with 100% load on one CPU core.

I use Arch Linux with sway (Wayland). I guess window distraction is connected to this somehow.

dydyamotya commented 8 months ago

Finally I've downloaded AppImage, which launches in X11 (XWayland mode) and it works.

[gui] glfwGetVersionString() : 3.4.0 X11 GLX Null EGL OSMesa monotonic
[gui] monitor [0] DP-1 at 0 0
[gui] monitor [1] DP-2 at 2909 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_KHR_xcb_surface
[qvk] validation layer: Copying old device 0 into new device 0
[qvk] dev 0: vendorid 0x1002
[qvk] dev 0: AMD Radeon RX 6700 XT (RADV NAVI22)
[qvk] max number of allocations -1
[qvk] max image allocation size 16384 x 16384
[qvk] max uniform buffer range 4294967295
[qvk] num queue families: 2
[qvk] picked device 0 with ray tracing and without float atomics support
[qvk] available surface formats:
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] colour space: 0
[gui] found joystick A4TECH USB Device Keyboard
[gui] disabling joystick due to explicit config request. enable by
[gui] setting 'intgui/disable_joystick:0' in ~/.config/vkdt/config.rc
[gui] no display profile file display.DP-1, using sRGB!
[gui] no display profile file display.DP-2, using sRGB!
[qvk] available surface formats:
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] colour space: 0

So, we are not wayland yet. I'll try to port vkdt to Wayland, though. Thanks for help!

hanatos commented 8 months ago

hmm. will fix the colour uint thing.

wayland: what you describe sounds like https://github.com/glfw/glfw/issues/1520

and should be fixed. which version of glfw did you use when you compiled yourself?

[edit: i was running successfully natively on wayland before, possible that the new threading changes broke it]

blitzgneisserin commented 8 months ago

So, we are not wayland yet. I'll try to port vkdt to Wayland, though. Thanks for help!

I have run vkdt on Ubuntu and Arco Linux with Hyprland and according to my tests Xwayland was not needed, therefore I think it has something to do with the driver (I use Nvidia).

dydyamotya commented 8 months ago

I figured it out!

I have two monitors on sway one with floating point scale factor.

And I was launching on scaled monitor. If the window somehow were created, there were gaps around a window, and viewport was very small, like that: image

After that I started on 1:1 monitor and everything is okay.

I've tried to add glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);

to window initialization, but that didn't worked out.

So, I guess this PR is about adding support for scaled monitors :)

dydyamotya commented 8 months ago

Hello again.

I've started research about this and found that for scaled monitors framebuffer pixel sizes to be used.

Found that in https://vulkan-tutorial.com/resources/vulkan_tutorial_en.pdf on page 79, topic about "Swap extent".

I've implemented this in create_swap_chain like that:

src/gui/gui.c:210

  int width, height;
  glfwGetFramebufferSize(qvk.window, &width, &height);
  QVKR(qvk_create_swapchain(width, height));

src/qvk/qvk.c:192

  if(surf_capabilities.currentExtent.width != ~0u)
  {
    qvk.extent = surf_capabilities.currentExtent;
  }
  else
  {

    VkExtent2D actualExtent = {
      (uint32_t)width,
      (uint32_t)height,
    };

    actualExtent.width = CLAMP(actualExtent.width,
                               surf_capabilities.minImageExtent.width,
                               surf_capabilities.maxImageExtent.width);

    actualExtent.height = CLAMP(actualExtent.height,
                               surf_capabilities.minImageExtent.height,
                               surf_capabilities.maxImageExtent.height);

    qvk.extent = actualExtent;
  }

After that gaps disappeared. Though, gui was not placed correctly and after moving a vkdt window around the workspace something crashed my system. Probably I've coded something bad.

hanatos commented 7 months ago

i have no idea why people want to scale their monitors. vkdt will scale everything to a percentage of window height, including 4k/8k monitors. at any rate apparently there is some scaling support in glfw (whatever that does, i'd rather not support hidpi scaling, it feels like legacy stuff).

dydyamotya commented 7 months ago

Hello!

I can't agree with you, because I have two monitors with different DPI, and it would be useful to have programs UI understanding the correct equal size of fonts, widgets and other stuff.

Nonetheless, I've just pull --recurse-submodules and tried to rebuild and run the vkdt and failed now with different error:

[pipe] base directory /home/motya/packages/vkdt/bin
[pipe] home directory /home/motya/.config/vkdt
[pipe] loaded 76 modules
[gui] glfwGetVersionString() : 3.3.9 Wayland EGL OSMesa clock_gettime evdev shared
[gui] monitor [0] DP-1 at 0 0
[gui] monitor [1] DP-2 at 0 0
[gui] vk extension required by GLFW:
[gui]   VK_KHR_surface
[gui]   VK_KHR_wayland_surface
[qvk] validation layer: Copying old device 0 into new device 0
[qvk] validation layer: Copying old device 0 into new device 0
[qvk] dev 0: vendorid 0x1002
[qvk] dev 0: AMD Radeon RX 6700 XT (RADV NAVI22)
[qvk] max number of allocations -1
[qvk] max image allocation size 16384 x 16384
[qvk] max uniform buffer range 4294967295
[qvk] num queue families: 2
[qvk] picked device 0 with ray tracing and without float atomics and without coopmat support
[qvk] validation layer: vkCreateDevice extension VK_EXT_debug_marker not available for devices associated with ICD /usr/lib/libvulkan_radeon.so
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[gui] found joystick A4TECH USB Device Keyboard
[gui] disabling joystick due to explicit config request. enable by
[gui] setting 'intgui/disable_joystick:0' in ~/.config/vkdt/config.rc
[gui] no display profile file display.DP-1, using sRGB!
[gui] no display profile file display.DP-2, using sRGB!
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[db] allocating 1024.0 MB for thumbnails
[perf] time to load images 0.001s
[qvk] available surface formats:
[qvk] R16G16B16A16_SFLOAT
[qvk] R16G16B16A16_UNORM
[qvk] A2R10G10B10_UNORM_PACK32
[qvk] A2B10G10R10_UNORM_PACK32
[qvk] B8G8R8A8_SRGB
[qvk] B8G8R8A8_UNORM
[qvk] R8G8B8A8_SRGB
[qvk] R8G8B8A8_UNORM
[qvk] R5G6B5_UNORM_PACK16
[qvk] colour space: 0
[qvk] validation layer: Validation Error: [ VUID-vkCmdDispatch-magFilter-04553 ] Object 0: handle = 0x2b4c0000001277, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0xfab64d0000000002, name = qvk.tex_sampler, type = VK_OBJECT_TYPE_SAMPLER; Object 2: handle = 0x33c6f2000000118e, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0xb3df376 | vkCmdDispatch():  the descriptor (VkDescriptorSet 0x2b4c0000001277[], binding 3, index 0) has VkSampler 0xfab64d0000000002[qvk.tex_sampler] which is set to use VK_FILTER_LINEAR with compareEnable is set to VK_FALSE, but image view's (VkImageView 0x33c6f2000000118e[]) format (VK_FORMAT_R32_UINT) does not contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in its format features. The Vulkan spec states: If a VkSampler created with magFilter or minFilter equal to VK_FILTER_LINEAR and compareEnable equal to VK_FALSE is used to sample a VkImageView as a result of this command, then the image view's format features must contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDispatch-magFilter-04553)
vkdt: qvk/qvk.c:102: VkBool32 vk_debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT *, void *): Assertion `0' failed.
an error occurred while trying to execute gdb.please check if gdb is installed on your system.
backtrace written to /tmp/vkdt-bt-2471.txt
recovery data written to /tmp/vkdt-crash-recovery.*

Could you please navigate me again, where can I dig to find out, what's the problem. I've tried to grep all the places, where the ImageView is created, but that wasn't helpful.

Thank you!

hanatos commented 7 months ago

did you attach a colour picker or something already? the issue seems to be the "atom" data type, which would be f32 on systems that support it and ui32 for you. apparently it is using ui32, as it should, but it is trying to interpolate the pixel data which is not supported. anyhow this should not happen until you attach a colour picker to the colour module.

On Sun, Feb 11, 2024 at 11:24 AM dydyamotya @.***> wrote:

Hello!

I can't agree with you, because I have two monitors with different DPI, and it would be useful to have programs UI understanding the correct equal size of fonts, widgets and other stuff.

Nonetheless, I've just pull --recurse-submodules and tried to rebuild and run the vkdt and failed now with different error:

[pipe] base directory /home/motya/packages/vkdt/bin [pipe] home directory /home/motya/.config/vkdt [pipe] loaded 76 modules [gui] glfwGetVersionString() : 3.3.9 Wayland EGL OSMesa clock_gettime evdev shared [gui] monitor [0] DP-1 at 0 0 [gui] monitor [1] DP-2 at 0 0 [gui] vk extension required by GLFW: [gui] VK_KHR_surface [gui] VK_KHR_wayland_surface [qvk] validation layer: Copying old device 0 into new device 0 [qvk] validation layer: Copying old device 0 into new device 0 [qvk] dev 0: vendorid 0x1002 [qvk] dev 0: AMD Radeon RX 6700 XT (RADV NAVI22) [qvk] max number of allocations -1 [qvk] max image allocation size 16384 x 16384 [qvk] max uniform buffer range 4294967295 [qvk] num queue families: 2 [qvk] picked device 0 with ray tracing and without float atomics and without coopmat support [qvk] validation layer: vkCreateDevice extension VK_EXT_debug_marker not available for devices associated with ICD /usr/lib/libvulkan_radeon.so [qvk] available surface formats: [qvk] R16G16B16A16_SFLOAT [qvk] R16G16B16A16_UNORM [qvk] A2R10G10B10_UNORM_PACK32 [qvk] A2B10G10R10_UNORM_PACK32 [qvk] B8G8R8A8_SRGB [qvk] B8G8R8A8_UNORM [qvk] R8G8B8A8_SRGB [qvk] R8G8B8A8_UNORM [qvk] R5G6B5_UNORM_PACK16 [qvk] colour space: 0 [gui] found joystick A4TECH USB Device Keyboard [gui] disabling joystick due to explicit config request. enable by [gui] setting 'intgui/disable_joystick:0' in ~/.config/vkdt/config.rc [gui] no display profile file display.DP-1, using sRGB! [gui] no display profile file display.DP-2, using sRGB! [qvk] available surface formats: [qvk] R16G16B16A16_SFLOAT [qvk] R16G16B16A16_UNORM [qvk] A2R10G10B10_UNORM_PACK32 [qvk] A2B10G10R10_UNORM_PACK32 [qvk] B8G8R8A8_SRGB [qvk] B8G8R8A8_UNORM [qvk] R8G8B8A8_SRGB [qvk] R8G8B8A8_UNORM [qvk] R5G6B5_UNORM_PACK16 [qvk] colour space: 0 [db] allocating 1024.0 MB for thumbnails [perf] time to load images 0.001s [qvk] available surface formats: [qvk] R16G16B16A16_SFLOAT [qvk] R16G16B16A16_UNORM [qvk] A2R10G10B10_UNORM_PACK32 [qvk] A2B10G10R10_UNORM_PACK32 [qvk] B8G8R8A8_SRGB [qvk] B8G8R8A8_UNORM [qvk] R8G8B8A8_SRGB [qvk] R8G8B8A8_UNORM [qvk] R5G6B5_UNORM_PACK16 [qvk] colour space: 0 [qvk] validation layer: Validation Error: [ VUID-vkCmdDispatch-magFilter-04553 ] Object 0: handle = 0x2b4c0000001277, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0xfab64d0000000002, name = qvk.tex_sampler, type = VK_OBJECT_TYPE_SAMPLER; Object 2: handle = 0x33c6f2000000118e, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0xb3df376 | vkCmdDispatch(): the descriptor (VkDescriptorSet 0x2b4c0000001277[], binding 3, index 0) has VkSampler 0xfab64d0000000002[qvk.tex_sampler] which is set to use VK_FILTER_LINEAR with compareEnable is set to VK_FALSE, but image view's (VkImageView 0x33c6f2000000118e[]) format (VK_FORMAT_R32_UINT) does not contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in its format features. The Vulkan spec states: If a VkSampler created with magFilter or minFilter equal to VK_FILTER_LINEAR and compareEnable equal to VK_FALSE is used to sample a VkImageView as a result of this command, then the image view's format features must contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdDispatch-magFilter-04553) vkdt: qvk/qvk.c:102: VkBool32 vk_debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT , void ): Assertion `0' failed. an error occurred while trying to execute gdb.please check if gdb is installed on your system. backtrace written to /tmp/vkdt-bt-2471.txt recovery data written to /tmp/vkdt-crash-recovery.*

Could you please navigate me again, where can I dig to find out, what's the problem. I've tried to grep all the places, where the ImageView is created, but that wasn't helpful.

Thank you!

— Reply to this email directly, view it on GitHub https://github.com/hanatos/vkdt/issues/111#issuecomment-1937528189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMAKKL4F6UFTBFJWK4HKDLYTCL6ZAVCNFSM6AAAAABCUJZGGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGUZDQMJYHE . You are receiving this because you commented.Message ID: @.***>

dydyamotya commented 7 months ago

Yeah, totally correct diagnosis. How it can be fixed?

hanatos commented 7 months ago

please pull and let me know if that helped. i tried on an old intel on-board GPU laptop.. there were a couple of things (way too slow among them) to be considered.

On Mon, Feb 12, 2024 at 8:51 AM dydyamotya @.***> wrote:

Yeah, totally correct diagnosis. How it can be fixed?

— Reply to this email directly, view it on GitHub https://github.com/hanatos/vkdt/issues/111#issuecomment-1938187307, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMAKKMSHB6HKDYOZT2SUKLYTHCYPAVCNFSM6AAAAABCUJZGGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZYGE4DOMZQG4 . You are receiving this because you commented.Message ID: @.***>

dydyamotya commented 7 months ago

Hello. Yeah, now it solved, thanks.