## Summary When the first window is created, adapter selection tests each adapter by configuring the surface at 64x64 with the first format and alpha mode the surface reports. The renderer then configures the same surface again at the window's size with its preferred format. On the NVIDIA proprietary driver on X11, each swapchain creation waits on the X server for several refreshes, so the second configure adds a few hundred ms before the first frame. This makes the adapter test use the configuration the renderer will use (same format, alpha mode, present mode and size), and skips the renderer's own configure when the context was just created against that surface. Every candidate adapter is still tested by configuring the surface, so hybrid-GPU selection works as before. Windows that reuse an existing context, device recovery with an existing context, and the web path still configure in the renderer. Time from exec to first presented frame, `gpui` `hello_world` example (1000x1000 window), release-fast, 22 alternating runs each: | | min | median | max | |---|---|---|---| | main | 720 ms | 946 ms | 1053 ms | | this PR | 403 ms | 528 ms | 701 ms | The removed configure took 218-534 ms (median 316 ms) in those runs. Machine: Pop!_OS 24.04, GNOME on Xorg, RTX 4070 with driver 580.159.03, 4K and 1440p monitors. Other work was running on the machine at the time, so absolute numbers are noisy, but every patched run was faster than every unpatched one. On the same machine's integrated AMD GPU (Mesa RADV, `ZED_DEVICE_ID=0x164e`) each configure takes about 2-5 ms, so there is no measurable change. ## Testing - Ran `hello_world` on X11 with the NVIDIA GPU and the integrated AMD GPU: the first frame renders correctly, and window captures after resizing are pixel-identical to main's on both GPUs. Resizing and maximizing reach `update_drawable_size` with the new sizes, as on main. - Logged the configure calls made while creating the window: main makes two (64x64 `Bgra8UnormSrgb` in adapter selection, then 1000x1000 `Bgra8Unorm` in the renderer), this PR one (1000x1000 `Bgra8Unorm`). The startup resize and transparency updates don't reconfigure on either branch, because the size and alpha mode are unchanged. - `cargo test -p gpui_wgpu`, `./script/clippy -p gpui_wgpu`, `cargo fmt`. - Not tested: Wayland, multiple windows, device recovery. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). (No UI changes.) - [x] Tests cover the new or changed behavior. Release Notes: - Improved window startup time on Linux with NVIDIA GPUs. - [GPUI] Improved window startup time on Linux with NVIDIA GPUs.
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking discussion)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.