aboutsummaryrefslogtreecommitdiffstats
path: root/components/compositing/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* compositing: Move image output and shutdown management out of the compositor ↵Martin Robinson2025-02-201-1/+6
| | | | | | | | | | | | | | | | | | | | | | | (#35538) This is a step toward the renderer-per-WebView goal. It moves various details out of `IOCompositor`. - Image output: This is moved to servoshell as now applications can access the image contents of a `WebView` via `RenderingContext::read_to_image`. Most options for this are moved to `ServoShellPreferences` apart from `wait_for_stable_image` as this requires a specific kind of coordination in the `ScriptThread` that is also very expensive. Instead, paint is now simply delayed until a stable image is reached and `WebView::paint()` returns a boolean. Maybe this can be revisited in the future. - Shutdown: Shutdown is now managed by libservo itself. Shutdown state is shared between the compositor and `Servo` instance. In the future, this sharing might be unecessary. - `CompositeTarget` has been removed entirely. This no longer needs to be passed when creating a Servo instance. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
* libservo: Expose an `OffscreenRenderingContext` and use it for servoshell ↵Martin Robinson2025-02-171-1/+0
| | | | | | | | | | | | | | | | | | (#35465) Create a new `RenderingContext` which is used to render to a `SurfmanRenderingContext`-related offscreen buffer. This allows having a temporary place to render Servo and then blitting the results to a subsection of the parent `RenderingContext`. The goal with this change is to remove the details of how servoshell renders from the `Compositor` and prepare for the compositor-per-WebView world. Co-authred-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* feat: Turn `RenderingContext` into a trait (#35052)DK Liao2025-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: turn RenderingContext into a trait Signed-off-by: DK Liao <dklassic@gmail.com> Add comment and handle drop error Signed-off-by: DK Liao <dklassic@gmail.com> Add doc comment Signed-off-by: DK Liao <dklassic@gmail.com> Allow make_current to propagate Error Signed-off-by: DK Liao <dklassic@gmail.com> Fix all make_current occurances Signed-off-by: DK Liao <dklassic@gmail.com> Move back to Rc<dyn RenderingContext> Signed-off-by: DK Liao <dklassic@gmail.com> fix android/ohos Signed-off-by: DK Liao <dklassic@gmail.com> Fix build Signed-off-by: DK Liao <dklassic@gmail.com> fix android/ohos again Signed-off-by: DK Liao <dklassic@gmail.com> * Fix macOS smoke test Signed-off-by: DK Liao <dklassic@gmail.com> * Add comment for create_texture and destroy_texture Signed-off-by: DK Liao <dklassic@gmail.com> * Improve comments written Signed-off-by: DK Liao <dklassic@gmail.com> --------- Signed-off-by: DK Liao <dklassic@gmail.com>
* feat: `webxr` feature flag (#34241)Ngo Iok Ui (Wu Yu Wei)2024-11-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add webxr feature flag Add webxr feature flag to embedder_traits Add webxr flag to constellation Add webxr flag to compositor Add webxr flag to canvas Turn registry into optional Add webxr flag to servo lib Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> Co-authored-by: august kline <me@augustkline.com> * Cargo fmt Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> * Add missing license Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> * Cargo clippy Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> --------- Signed-off-by: Wu Yu Wei <yuweiwu@pm.me> Co-authored-by: august kline <me@augustkline.com>
* Move `RenderingContext` to `webrender_traits` (#32386)Martin Robinson2024-05-281-1/+1
| | | | | | The `gfx_traits` crate is gradually become just about text and fonts and this is one of the few things there that is standing in the way of this. Eventually `webrender_traits` will be the general cross-process compositor API, so this sort of makes sense as well.
* Initial internal support for multiple webviews (#31417)Ngo Iok Ui (Wu Yu Wei)2024-04-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add multiple concurrent top-level browsing contexts Co-authored-by: Delan Azabani <dazabani@igalia.com> * Rename variables and comments There are some variable and comments still use browser as names. This commit renames them to webview. * Update log message from web view to webview * Revert offscreen_framebuffer_id rename * Rename all web view to webview * Cargo fmt * Fix viewport/event/clear coordinates when multiview is disabled * Only deprecate things when multiview is enabled * Update WebViewManger with shown and invisible sets Replace visible_webviews and native_window_is_visible with shown_webviews and invisible_webviews. Add 4 more methods to set them accordingly. The behavior of is_effectively_visible will return true if the wbview is in shown_webviews set but not in invisible_webviews. * Update variant behaviors * Rename WebViewVisibilityChanged to MarkWebViewInvisible * Fix unit test by marking id 3 visible again * Update MarkWebViewInvisible and add UnmarkWebViewInvisible * Update format and doc comments * Clean up doc comments * Address style and naming changes * Rename UpdateWebView to UpdateFrameTreeForWebView * constellation: send frame tree unconditionally over focus and feature * Clarify shown and invisible sets in constellation WebViewManager * Eliminate forward_to_constellation!() * Actually remove the unused macro * Don’t gate compositor changes on multiview feature flag * Update todo in mouse event dispatch * Pass all visible webview ids in a single ReadyToPresent message * Fix compile and lint errors * servoshell: fix gap between minibrowser toolbar and webview * Fix failure in /_mozilla/mozilla/window_resizeTo.html * Fix compile warnings * Remove stray dbg!() * Remove confusing “effectively visible” logic (see #31815, #31816) * Allow embedder to show/hide/raise webviews without ipc * Update root pipeline only when painting order actually changes * Stop gating old focus and SetFrameTree behaviour behind Cargo feature * Use webview_id and WebViewId in webview-related code * Improve logging of webview-related embedder events * Allow webview Show and Raise events to optionally hide all others * Don’t do anything in response to WebViewPaintingOrder * Remove WebViewPaintingOrder, since its payload is unreliable * On MoveResizeWebView, only update root pipeline if rect changed * Rename IOCompositor methods for clarity * compositor: add event tracing; log webview ops even without ipc * Add temporary debug logging * Add more temporary debug logging * Remove temporary logging in compositor * Remove temporary debug logging * Add temporary debug logging, but defer I/O until panic * Capture a backtrace with each crash log entry * Proper error handling without panicking in WebViewManager * Clean up imports in constellation --------- Co-authored-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* gfx: Rename `WebrenderSurfman` to `RenderingContext` and move to `gfx` (#31184)Martin Robinson2024-01-271-2/+2
| | | | | | | | | | | This is a small cleanup that moves and renames this class. The rename is simply because we are exposing a lot about the details of Servo's rendering in the API and it makes sense to start thinking about abstracting that away a bit. This also moves the struct to `gfx`, which does have an effect on Servo's dependency graph. This adds a new dependency on gfx to `compositing`, but `compositing` had a transitive dependency on gfx before through `canvas`.
* Add initial support for offscreen rendering (#30767)Delan Azabani2023-12-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Offscreen rendering * shared memory case never actually rendered to backbuffer * fix compile errors (in theory) when gl crate feature disabled * update doc comments * remove dark CentralPanel border covering edges of viewport * clear to transparent, to avoid pink artifacts * fix mouse input for browser being consumed by egui * avoid destroying OpenGL resources unless resizing window * clean up compositing::gl * fix flickering around edges after resizing window * unset invalidate_last_render_target after invalidating * fix incorrect DRAW_FRAMEBUFFER name when blitting * bind the widget surface fbo before painting egui * make composite_specific_target take CompositeTarget, not Option * compositing: remove cargo feature “gl” * capitalise FBO in bind log message Co-authored-by: Martin Robinson <mrobinson@igalia.com> * capitalise FBO in drop log message Co-authored-by: Martin Robinson <mrobinson@igalia.com> * rename RenderTargetInfo fields and use OnceCell for next field * rename RenderTargetInfo.read to read_back_from_gpu * document servo_framebuffer_id in Minibrowser::update * rename needs_fbo to use_offscreen_framebuffer * capitalise FBO in unbind log message * clarify the purpose of Minibrowser::on_event * fix unused_must_use warning * reduce nesting in Minibrowser::update * use implicit format argument in panic * store Minibrowser.widget_surface_fbo as glow type * explain why servo_framebuffer_id is None in first call site * rename output_framebuffer_id to offscreen_framebuffer_id --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-5/+4
| | | | | * strict imports formatting * Reformat all imports
* Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323)Martin Robinson2023-09-101-1/+1
| | | | | | | | | | | | | | | | | | * Upgrade vendored version of WebRender * Patch WebRender: upgrade version of gleam * Restore hit testing implementation * Fix WebRender warnings * Adapt Servo to new WebRender * Update results * Add a workaround for #30313 This slightly expands text boundaries in order to take into account the fact that layout isn't measuring glyph boundaries.
* remove `extern crate` (#30311)Samson2023-09-081-3/+0
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* [NFC] compositing: extract types into new compositing_traits crate (#30125)Delan Azabani2023-08-181-132/+28
| | | | | | | | | | | * [NFC] compositing: extract types into new compositing_traits crate * [NFC] compositing: move InitialCompositorState back to compositing * [NFC] compositing: rename Msg to CompositorMsg * [NFC] compositing: revert changes to Cargo.toml features section * [NFC] compositing: merge imports
* winit: initial minibrowser (#29976)Delan Azabani2023-08-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * winit: add minibrowser feature that depends on egui{,-winit} * winit: carve out some space at the top of headed windows * winit: minimal toolbar and egui/winit integration (but no painting) * winit: try to paint with egui_glow (doesn’t work yet) * winit: add comment about toolbar size * Add framebuffer object, set it as glow's target * compositing: clear only the viewport, not the whole framebuffer * plumb the actual size of the egui toolbar to webrender * fix formatting * winit: fix crash when fbo is zero * winit: don’t bother binding the framebuffer object * winit: remove unsafe and get toolbar_height * winit: location field should reflect the current top-level url * [NFC] winit: move Minibrowser out of App::run * winit: clean up toolbar height code * winit: make App own the Minibrowser if any * winit: make the go button work * winit:make the location field reflect the current top-level url * winit: allow enabling minibrowser from command line * winit: tell compositor to repaint WR and flush when we repaint * winit: fix bug where location field edits would get overridden * winit: borrow the minibrowser once in App::handle_events * winit: address todo about viewport origin coordinates * winit: fix some minor problems with comments and errors * winit: update location field once per HistoryChanged event * winit: rename Window::set_toolbar_size to set_toolbar_height * winit: take toolbar height into account in hit testing * winit: pass egui only relevant CursorMoved events * winit: scratch that, coalesce minibrowser updates instead * ensure both minibrowser and WR are repainted on every frame * compositing: only skip framebuffer clear in external present mode * winit: destroy egui glow Painter when shutting down * winit: clean up and fix license lint * fix duplicate versions lint by downgrading bytemuck_derive was egui_glow ^0.22.0 (0.22.0) → egui/bytemuck ^0.22.0 (0.22.0) → epaint/bytemuck ^0.22.0 (0.22.0) → bytemuck ^1.7.2 (1.13.1) → bytemuck_derive ^1.4 (1.4.1) → syn ^2.0.1 (2.0.28) now lock has bytemuck_derive 1.4.0 → syn ^1.0.99 (1.0.103) * fix duplicate versions lint by disabling egui-winit/links (we don’t need support for hyperlinks in our use of egui) * squelch duplicate versions lint by excluding clipboard-win * winit: fix compile warnings * winit: make gleam an optional dependency under /minibrowser * winit: remove cargo feature, since it’s not really optional * winit: extract Minibrowser and related code to separate module * winit: remove unnecessary trailing comma * winit: simplify the ServoUrl serialisation optimisation --------- Co-authored-by: atbrakhi <atbrakhi@igalia.com>
* Create initial browser id for compositor on startup.Josh Matthews2021-10-181-5/+1
|
* Make reload button clear the network cache.Josh Matthews2020-07-271-0/+3
|
* Unfocus input when virtual keyboard is dismissedPaul Rouget2020-07-131-0/+3
|
* Update to 7/6 rustc.Josh Matthews2020-07-061-1/+0
|
* Update surfman to 0.2 and remove glutinAlan Jeffrey2020-04-171-0/+1
|
* Remove WebVRAlan Jeffrey2020-04-081-4/+0
|
* Stop animations when window is hidden (API + UWP)Paul Rouget2020-02-191-0/+3
|
* move ConstellationMsg to compositingKunal Mohan2020-01-291-1/+110
|
* Move RenderNotifier from compositing to servoNiko Pen2019-02-281-1/+1
|
* Initial window sizes are mandatory.Josh Matthews2018-12-141-3/+0
|
* Rename gleam feature to gl in compositingAnthony Ramine2018-11-201-1/+1
|
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* `cargo fix --edition-idioms`Simon Sapin2018-11-081-22/+0
|
* Reorder importsPyfisch2018-11-061-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-061-4/+4
|
* Use keyboard-types cratePyfisch2018-10-071-0/+1
| | | | | | | | | | | | | Have embedders send DOM keys to servo and use a strongly typed KeyboardEvent from the W3C UI Events spec. All keyboard handling now uses the new types. Introduce a ShortcutMatcher to recognize key bindings. Shortcuts are now recognized in a uniform way. Updated the winit port. Updated webdriver integration. part of #20331
* Replace mpsc with crossbeam/servo channel, update ipc-channelSimon Sapin2018-09-121-0/+1
| | | | Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
* Remove components/nonzero, use std::num::NonZero insteadSimon Sapin2018-06-161-1/+0
|
* move msg to embedder_traits, use in script, handle send error in embedderGregory Terzian2018-05-231-0/+1
|
* Make gleam optional for compositor, switch various names from glutin to winitDzmitry Malyshau2018-04-181-0/+4
|
* Update webrender for latest RenderNotifier changes.Josh Matthews2017-10-231-0/+1
|
* Switch to using WebRender hit testingMartin Robinson2017-10-171-0/+1
| | | | | | | | This trades quite a bit of complicated code in Servo for few more messages and a significant performance improvement. In particular, WebRender can search the entire display list at once instead of ping-ponging down the pipeline tree. This allows us to send mouse events to the correct pipeline immediately.
* Use wrappers in the nonzero crate so users don’t need unstable featuresSimon Sapin2017-10-131-1/+0
|
* Use the new nonzero crate in the msg crateSimon Sapin2017-10-131-2/+2
|
* Remove usage of unstable box syntax, except in the script crateSimon Sapin2017-10-121-1/+0
| | | | | … because there’s a lot of it, and script still uses any other unstable features anyway.
* Made PipelineId non-zero, so optional ids take no more space.Alan Jeffrey2017-09-181-0/+2
|
* move embedder related messages, and window event handling, out of compositorGregory Terzian2017-08-281-0/+1
|
* Upgrade to the latest version of WebRenderMartin Robinson2017-07-131-1/+1
|
* Improve decisions in compositor over when to draw a frame.Glenn Watson2017-06-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | This patch fixes a couple of issues in the compositor: 1) Remove the delayed composition code. Previously, this would schedule a composite for 12ms in the future. This doesn't really make any sense with WR. There's no point in doing a composite unless WR has provided a new frame to be drawn. This fixes issues in several benchmarks where we were doing multiple composite / renders per rAF, which is a waste of CPU time. This *does* make the framerate slower in some cases (such as a slow rAF callback) but it's more correct - otherwise we were just compositing the same frame multiple times for no real benefit. 2) Inform the window of the current animation state of the compositor. Specifically, if an animation (or rAF) is currently active, the window system switches to use event polling, and does not block on the OS-level event loop. In the case of active animation, we just assume that we want to be running as the vsync interval and not blocking. This means the compositor thread only sleeps on vsync during animation, which reduces OS scheduling and results in much smoother animation.
* Bump euclid to 0.14.Nicolas Silva2017-06-141-1/+1
|
* Webdriver uses browsing context ids rather than pipeline ids.Alan Jeffrey2017-05-251-0/+2
|
* Introduce CSSPixel as a replacement for ViewportPx and PagePx.Glenn Watson2017-02-241-2/+2
|
* Kill the plugins crate and its clippy supportAnthony Ramine2017-02-211-4/+1
| | | | | | Sometimes clippy gets outdated by months, and its current support setup means that each Servo component need to opt into it by depending on the plugins crate manually, and not all components do that.
* Update rustc to 1.16.0-nightly (7821a9b99 2017-01-23).Ms2ger2017-01-241-3/+0
|
* Upgrade to rustc 1.16.0-nightly (6f1ae663e 2017-01-06)Simon Sapin2017-01-061-1/+0
|
* Removed util.Alan Jeffrey2016-12-141-2/+2
|
* Urlmageddon: Use refcounted urls more often.Emilio Cobos Álvarez2016-11-171-1/+1
|