Bug 164394 - Skia/Vulkan initialization fails due to illegal vkCreateXcbSurfaceKHR call
Summary: Skia/Vulkan initialization fails due to illegal vkCreateXcbSurfaceKHR call
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.8.0
Keywords:
Depends on:
Blocks: Skia
  Show dependency treegraph
 
Reported: 2024-12-20 15:06 UTC by Jonathan Clark
Modified: 2025-01-17 17:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Clark 2024-12-20 15:06:32 UTC
Description:
At startup, Skia/X11 tries to create a number of 1x1-pixel swapchains on a null window. These calls fail on my machine, and LibreOffice falls back to using Raster.

Validation layer output shows these calls violate the Vulkan spec:

> $ SAL_USE_VCLPLUGIN=gen SAL_FORCESKIA=1 SAL_SKIA=vulkan ./instdir/program/soffice
> VUID-VkXcbSurfaceCreateInfoKHR-window-01311(ERROR / SPEC): msgNum: 1562353943 - Validation Error: [ VUID-VkXcbSurfaceCreateInfoKHR-window-01311 ] | MessageID = 0x5d1fa117 | vkCreateXcbSurfaceKHR(): pCreateInfo->window is zero. The Vulkan spec states: window must be a valid X11 xcb_window_t (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkXcbSurfaceCreateInfoKHR-window-01311)
>     Objects: 0
> VUID-VkXcbSurfaceCreateInfoKHR-window-01311(ERROR / SPEC): msgNum: 1562353943 - Validation Error: [ VUID-VkXcbSurfaceCreateInfoKHR-window-01311 ] | MessageID = 0x5d1fa117 | vkCreateXcbSurfaceKHR(): pCreateInfo->window is zero. The Vulkan spec states: window must be a valid X11 xcb_window_t (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkXcbSurfaceCreateInfoKHR-window-01311)
>     Objects: 0
> warn:vcl.skia:34946:34946:vcl/skia/SkiaHelper.cxx:533: Cannot create Vulkan GPU context, falling back to Raster

This issue originates in LibreOffice code, not upstream Skia code. LibreOffice passes an invalid window to Skia while constructing some temporary devices. I haven't debugged any further than this.

Windows Skia/Vulkan works correctly on my machine. Other Linux Vulkan programs work correctly on my machine.

Steps to Reproduce:
1. Install Vulkan validation layers for run-time debugging. On Ubuntu, this is the vulkan-validationlayers apt package.
2. Build LibreOffice with the --enable-skia-vulkan-validation build option.
3. Run LibreOffice with Vulkan (e.g. SAL_USE_VCLPLUGIN=gen SAL_FORCESKIA=1 SAL_SKIA=vulkan)

Actual Results:
LibreOffice generates Vulkan validation errors at startup due to incorrect Vulkan API use.

Note that LibreOffice may work on your machine, despite these errors. This bug should be considered reproduced if these validation errors are printed, whether or not your computer tolerates them.

Expected Results:
LibreOffice should run without Vulkan validation errors.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 496c409841d9ee71964af8a8afdc121282e69a63
CPU threads: 32; OS: Linux 6.8; UI render: Skia/Raster; VCL: x11
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Relevant snippet from vulkaninfo:

> Presentable Surfaces:
> =====================
> GPU id : 0 (AMD Radeon RX 7900 XTX (RADV NAVI31)):
>         Surface types: count = 2
>                 VK_KHR_xcb_surface
>                 VK_KHR_xlib_surface
>         Formats: count = 2
>                 SurfaceFormat[0]:
>                         format = FORMAT_B8G8R8A8_SRGB
>                         colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
>                 SurfaceFormat[1]:
>                         format = FORMAT_B8G8R8A8_UNORM
>                         colorSpace = COLOR_SPACE_SRGB_NONLINEAR_KHR
>         Present Modes: count = 4
>                 PRESENT_MODE_IMMEDIATE_KHR
>                 PRESENT_MODE_MAILBOX_KHR
>                 PRESENT_MODE_FIFO_KHR
>                 PRESENT_MODE_FIFO_RELAXED_KHR
Comment 1 Buovjaga 2024-12-26 12:12:23 UTC
Repro after installing https://archlinux.org/packages/extra/x86_64/vulkan-validation-layers/ and building with the option. I get:

VUID-VkXcbSurfaceCreateInfoKHR-window-01311(ERROR / SPEC): msgNum: 1562353943 - Validation Error: [ VUID-VkXcbSurfaceCreateInfoKHR-window-01311 ] | MessageID = 0x5d1fa117 | vkCreateXcbSurfaceKHR(): pCreateInfo->window is zero.
The Vulkan spec states: window must be a valid X11 xcb_window_t (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkXcbSurfaceCreateInfoKHR-window-01311)

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 4b547f11ae3e943e67c195a67a033307ce7f1d6d
CPU threads: 8; OS: Linux 6.12; UI render: Skia/Raster; VCL: x11
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Comment 2 Commit Notification 2025-01-17 17:58:25 UTC
Jonathan Clark committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/145d82b5f0cab44a8c34071ddc4458dd3756f6e5

tdf#164394 Fix Vulkan vkCreateXcbSurfaceKHR validation error

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.