Skip to content
Snippets Groups Projects

qt: improve startup speed on Windows by probing rhi asynchronously and caching the result

Merged Fatih Uzunoğlu requested to merge fuzun/vlc:qt/cacherhiproberesult into master

We currently check on Windows if the default graphics backend is supported and do cross-graphics api fallback. Qt uses Direct3D 11.2 by default, and does not fallback to others (OpenGL, Vulkan, Software, ...). If I remember correctly, Qt 6.8 may fallback to Direct3D 11.2 WARP (software rasterizer) if swapchain creation fails, which we would not prefer but rather use OpenGL. This is currently the case for Windows 7, as Qt RHI's d3d11 abstraction is not supported on Windows 7.

QRhi::probe() can be really expensive, so what we are doing now (synchronous probing at each start) is not ideal as that causes delaying playing the initial item.

Startup time is defined as the time it takes to start playing the initial item when the application is opened.

Currently probing is done synchronously each time the interface starts. This is not ideal, as we don't expect the system to suddenly start supporting a particular graphics api. Obviously, due to hardware change or driver update or any reason this may change, so we still need to check that each time.

In this case, the worst can happen is that QQuickWindow emits error and terminates the application (usually with an error message box) when the api is no longer supported. However, since the cached api is checked each time asynchronously, the next startup would be fine.

This basically improves the startup performance, at the expense of causing an error and terminating the application (in the worst case) if the system suddenly starts not supporting once valid api. The worst case is a rare case, so I believe that this would be a good optimization.

Request review @chub.

Merge request reports

Merge request pipeline #579816 passed

Merge request pipeline passed for d668d601

Test coverage 17.97% (-0.01%) from 1 job

Merged by Steve LhommeSteve Lhomme 1 month ago (Mar 24, 2025 10:17am UTC)

Loading

Pipeline #579821 passed

Pipeline passed for d668d601 on master

Test coverage 17.95% (-0.01%) from 1 job

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading