LibGfx: Show selected graphical device or if in CPU painter fallback
Clearly show which graphical device is being used or if we are falling back to the CPU painter.
This is so that when GPU or CPU painter issues are reported, that the graphical state of the system is clearly shown in the output logs.
fixed: #6385
Output from vm with Ubuntu 24.04.2 LTS
$ ./Meta/ladybird.py run
ninja: Entering directory `/home/ubuno/projects/myladybird/Build/release'
ninja: no work to do.
21853.950 WebContent(113515): Selected Vulkan graphical device: llvmpipe (LLVM 20.1.2, 256 bits)
21853.950 WebContent(113515): Vulkan context creation failed: Logical device creation failed
21853.950 WebContent(113515): Falling back to CPU Backend painter
21854.056 WebContent(113522): Selected Vulkan graphical device: llvmpipe (LLVM 20.1.2, 256 bits)
21854.059 WebContent(113522): Vulkan context creation failed: Logical device creation failed
21854.059 WebContent(113522): Falling back to CPU Backend painter
Output from same system using --force-cpu-painting
$ ./Meta/ladybird.py run ladybird --force-cpu-painting
ninja: Entering directory `/home/ubuno/projects/myladybird/Build/release'
ninja: no work to do.
Ladybird PID file '/run/user/1000/Ladybird.pid' exists with PID 113497, but process cannot be found
22102.468 WebContent(113573): Falling back to CPU Backend painter
22102.550 WebContent(113578): Falling back to CPU Backend painter
Output from vm with Ubuntu 25.04
$ ./Meta/ladybird.py run
ninja: Entering directory `/home/bobo/projects/myladybird/Build/release'
ninja: no work to do.
22811.802 WebContent(38678): Selected Vulkan graphical device: llvmpipe (LLVM 20.1.2, 256 bits)
22811.868 WebContent(38682): Selected Vulkan graphical device: llvmpipe (LLVM 20.1.2, 256 bits)
Output from real hardware Ubuntu 25.04
$ ./Meta/ladybird.py run
ninja: Entering directory `/home/bobo/projects/myladybird/Build/release'
ninja: no work to do.
16791.114 WebContent(26334): Selected Vulkan graphical device: Intel(R) UHD Graphics 630 (CFL GT2)
16791.123 WebContent(26338): Selected Vulkan graphical device: Intel(R) UHD Graphics 630 (CFL GT2)
Output from MacOS Intel based with AMD video adapter
% ./Meta/ladybird.py run
ninja: Entering directory `/Users/roccocorsi/projects/myladybird/Build/release'
ninja: no work to do.
2025-10-14 15:10:48.553 Ladybird[90303:473813] WARNING <NSToolbarItem: 0x600002599ba0> -> view was automatically measured but had an ambiguous height or width and the view's frame size had a zero height or width. Did you forget to add constraints on your view or its subview(s)? Try adding constraints or give the view an intrinsicContentSize
2025-10-14 15:10:48.553 Ladybird[90303:473813] WARNING <NSToolbarItem: 0x600002599ba0> -> view was automatically measured but had an ambiguous height or width and the view's frame size had a zero height or width. Did you forget to add constraints on your view or its subview(s)? Try adding constraints or give the view an intrinsicContentSize
2025-10-14 15:10:48.666 Ladybird[90303:473813] WARNING <NSToolbarItem: 0x600002599ba0> -> view was automatically measured but had an ambiguous height or width and the view's frame size had a zero height or width. Did you forget to add constraints on your view or its subview(s)? Try adding constraints or give the view an intrinsicContentSize
2025-10-14 15:10:48.667 Ladybird[90303:473813] WARNING <NSToolbarItem: 0x600002599ba0> -> view was automatically measured but had an ambiguous height or width and the view's frame size had a zero height or width. Did you forget to add constraints on your view or its subview(s)? Try adding constraints or give the view an intrinsicContentSize
11824.804 WebContent(90306): Selected Metal graphical device: AMD Radeon Pro 5500M
11825.154 WebContent(90307): Selected Metal graphical device: AMD Radeon Pro 5500M
11851.937 Ladybird(90303): mach_msg failed: (ipc/rcv) port changed
I have a FIXME in the commit changes. I wasn't sure if it was appropriate to call string functions in UI/AppKit from Libraries/LibGfx
This change is the first part of some fixes related to the Ladybird graphical function.
Things still being worked on:
1- On WSL2 and older systems, they can't handle shareable Vulkan context, so want to detect that during build and bypass the usage so that the GPU can work on those systems. #6163 #6386 2- When using CPU Backend painter a lot of output problems in all platforms I'm using. #6031 #6322 #6392 3- On MacOS Intel side (that's what I have) I am seeing a lot of little graphical issue. Would like to look into them. When I see Andreas videos his Mac appears to work great, so maybe on Mx series (I'm assuming he has a recent Mx system) things are better?!?
@manuel-za wanted to make you aware of this fix. Might impact your testing. I'm wondering if you are looking at the output when using --headless mode?
Output from headless might look like this. Do you see any problems? Those extra debug output lines might slow things down a little bit, don't know how precise your tests are.
$ ./Meta/ladybird.py run ladybird --headless
ninja: Entering directory `/home/ubuno/projects/myladybird/Build/release'
ninja: no work to do.
Taking screenshot after 1 seconds
25045.167 WebContent(113759): Selected Vulkan graphical device: llvmpipe (LLVM 20.1.2, 256 bits)
25045.167 WebContent(113763): Selected Vulkan graphical device: llvmpipe (LLVM 20.1.2, 256 bits)
25045.167 WebContent(113759): Vulkan context creation failed: Logical device creation failed
25045.167 WebContent(113763): Vulkan context creation failed: Logical device creation failed
25045.167 WebContent(113759): Falling back to CPU Backend painter
25045.167 WebContent(113763): Falling back to CPU Backend painter
Saved screenshot to: /home/ubuno/Downloads/screenshot-2025-10-14-16-39-11.png
Forgot to mention that this would fix #6385
Output from headless might look like this [...]
Looks good. Useful.
OpenSUSE Leap 15.6 gives this output:
> ./Meta/ladybird.py run
ninja: Entering directory `/home/suseo/projects/myladybird/Build/release'
ninja: no work to do.
Qt: Session management error: Authentication Rejected, reason : MIT-MAGIC-COOKIE-1 authentication rejected
2077.657 WebContent(17166): vkCreateInstance returned -9
2077.657 WebContent(17166): Vulkan context creation failed: Application instance creation failed
2077.657 WebContent(17166): Falling back to CPU Backend painter
2077.677 WebContent(17176): vkCreateInstance returned -9
2077.677 WebContent(17176): Vulkan context creation failed: Application instance creation failed
2077.677 WebContent(17176): Falling back to CPU Backend painter
Hi @kalenikaliaksandr, what do you think of the updated changes that I made? Is it better?
And more generally what do you think of this feature? Boarder line useful or thumbs down? :-)
Thanks for your feedback.
Hi @kalenikaliaksandr regarding the SVG issue you mentioned, I tested with my latest commit and I do not see any printouts about falling back to CPU backend when displaying some SVG files.
I displayed several files from w3.org at https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/
I did checkout the older commit with the dbgln messages in the constructors in Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp about falling back to the CPU backend and I did see some printouts about falling back to CPU backend when accessing SVG files, but not very often. This one seems to be special though:
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/gallardo.svg
It is showing 9 messages about falling back when it is rendered.
When I am on the latest commit, no messages are shown for the same file. So the current commit looks good for SVG files, no spam messages.
These also cause the dbgln fallback message to print with the old code, but not with the latest commit.
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/clippath.svg https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/gaussian1.svg https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/gaussian2.svg https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/gaussian3.svg https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/juanmontoya_lingerie.svg https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/scimitar-anim.svg https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/scimitar.svg
This one rendered, but threw some javascript SyntaxError
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/displayWebStats.svg
This one is animated on Firefox, but not on Ladybird, and final render is not perfect (compared to Firefox result)
https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/svg2009.svg
I also tried with the SVG files under the Tests directory of ladybird repo, using this command to open tabs with all 73 files that we have.
find Tests/ -name "*.svg" | xargs ./Build/release/bin/Ladybird
I clicked on each tab and only two of them cause the fallback message to appear when using the original commit.
Tests/LibWeb/Ref/input/wpt-import/svg/embedded/image-embedding-svg-with-auto-height.svg
Tests/LibWeb/Ref/input/wpt-import/svg/embedded/image-embedding-svg-viewref-with-viewbox.svg
Only improvement I can see to the current code is to generate the message(s) about the context and/or fallback once at startup.
Would that be the ideal implementation that would get this PR merged?
Your pull request has conflicts that need to be resolved before it can be reviewed and merged. Make sure to rebase your branch on top of the latest master.
CLosing for now and will be putting this feature together in another PR related to graphical hardware, coming soon.