Commit graph

163 commits

Author SHA1 Message Date
Masayuki Nakano
86ac873214 Bug 1712675 - part 2: Make any cpp file under widget/gtk stop redefining LOG macro r=rmader,stransky
`LOG` is defined by `nsWindow.h` for a shortcut of `MOZ_LOG` for generic use
under `widget/gtk`.  However, some cpp files do `#undef LOG` and redefine it.
This causes the CPP file order important in unified cpp files since a CPP
file's `LOG` may be redefined unexpectedly with changing the unified order
and/or group.  Therefore, each cpp file should define its own macro name
instead of redefining `LOG`.

Differential Revision: https://phabricator.services.mozilla.com/D115978
2021-05-26 22:53:30 +00:00
Robert Mader
5f9ec00358 Bug 1711094 - Move WindowBackBuffer into own file and rename it to WaylandShmBuffer, r=stransky
In preperation to reuse it for a second `WindowSurface` backend as well
as `NativeLayerWayland`.

There should be no fundamental changes, just some restructuring:
 - Make `WaylandShmBuffer` as generic as possible so it can be easily
   reused
 - Remove resizing of buffers and create new ones instead. This is in
   order to reduce complexety at a likely low cost.
 - Make more use of refcounting, in order to make it easier to ensure
   things don't vanish beneath our feet.
 - Make some parts of the code more Mozillian/C++y, as opposed to
   Gnome-/C-ish, in order to make it easier to read for other FF-devs.
 - Fix some complains of static analysis

Differential Revision: https://phabricator.services.mozilla.com/D115083
2021-05-17 12:13:21 +00:00
Robert Mader
7d30021666 Bug 1710532 - Use LayoutDeviceIntSize instead of LayoutDeviceIntRect where appropriate, r=stransky
The `x` and `y` where never used, thus `IntSize` appears to be more
appropriate.

Depends on D114799

Differential Revision: https://phabricator.services.mozilla.com/D114800
2021-05-11 09:44:40 +00:00
Robert Mader
4cde7dfa5c Bug 1707209 - [wayland] Implement experimental fractional scaling support, r=stransky
Fractional scaling currently comes at a high performance cost as we
only support integer scaling for rendering. The overdraw ratio is
something like (ceil(scale) / scale)^2, which for 125% scaling means
we're drawing 2.56 times as much as we should.

In theory we already support everything needed to have proper fractional
scaling: Webrender support appears to be in great shape and on the Wayland
side we can use the wp_viewporter protocol to have arbitrary
buffer size <-> surface size relationships. The main blocker remains the
lack of proper negotiation between client and compositor about the
optimal buffer size.

In order to speed up the upstream discussion, lets implement it via a
fixed value that can be set in `about:config` for testing purposes
(`widget.wayland.fractional_buffer_scale`).
It will, of course, require wp_viewporter support from the compositor.

Differential Revision: https://phabricator.services.mozilla.com/D113321
2021-04-26 13:57:23 +00:00
Olivier Tilloy
17b5edfc93 Bug 1701182 - Prepend SNAP-specific prefix to shm path. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D110269
2021-04-09 14:41:31 +00:00
Butkovits Atila
c6955ce4d0 Backed out changeset caf472555c8a (bug 1701182) for causing failure on test_snap_empty.js. CLOSED TREE 2021-04-08 05:26:26 +03:00
Olivier Tilloy
7b5c4d8ee0 Bug 1701182 - Prepend SNAP-specific prefix to shm path. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D110269
2021-04-07 20:55:42 +00:00
stransky
dc24c155c2 Bug 1702606 [Wayland] Don't call mWaylandDisplay::WaitForSyncEnd() from Compositor/Render thread, r=rmader
Differential Revision: https://phabricator.services.mozilla.com/D110590
2021-04-02 14:26:20 +00:00
stransky
6811ae4b32 Bug 1693472 [Wayland] Always use direct drawing on KWin, r=rmader
Differential Revision: https://phabricator.services.mozilla.com/D110427
2021-04-01 14:28:41 +00:00
Andreea Pavel
e86d10c304 Backed out changeset c83c9af968f8 (bug 1701182) for build bustages at system_wrappers/gdk/gdk.h on a CLOSED TREE 2021-03-31 19:33:47 +03:00
Olivier Tilloy
45068bf782 Bug 1701182 - Prepend SNAP-specific prefix to shm path. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D110269
2021-03-31 15:52:07 +00:00
Dorel Luca
f0985635c0 Backed out changeset 627da64827ab (bug 1701182) for build bustages in gecko/browser/components/shell/nsGNOMEShellService.cpp. CLOSED TREE 2021-03-30 21:32:39 +03:00
Olivier Tilloy
24c53bd998 Bug 1701182 - Prepend SNAP-specific prefix to shm path. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D110269
2021-03-30 18:03:30 +00:00
stransky
06c83032c0 Bug 1683578 [wayland] Use wl_surface ID instead of wl_surface address when check for stored frame callback, r=jhorak
Depends on D104711

Differential Revision: https://phabricator.services.mozilla.com/D104712
2021-02-11 15:30:17 +00:00
stransky
a3a1f17129 Bug 1683578 [Wayland] When MozContainer and wl_buffer size does not match, reset/flush all pending drawings, r=jhorak
- When there's cached drawing from previous rendering and widget size changes, we can't paint the cached drawings.
  Instead create a new wl_buffer with size of MozContainer and clear the cache.

Depends on D104710

Differential Revision: https://phabricator.services.mozilla.com/D104711
2021-02-11 15:30:17 +00:00
stransky
328194cc7d Bug 1683578 [Wayland] Rename mBufferPendingCommit to mWLBufferIsDirty to explicitly state wl_buffer state, r=jhorak
Depends on D104709

Differential Revision: https://phabricator.services.mozilla.com/D104710
2021-02-11 15:30:16 +00:00
stransky
3fb17b64f9 Bug 1683578 [Wayland] Rename LockedScreenRect to MozContainerRect to explicitly state it's MozContainer size, r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D104709
2021-02-11 15:30:16 +00:00
stransky
c8518b1eae Bug 1667851 [Wayland] Use map_event to create wl_subsurface of MozContainer when it's size is already allocated, r=jhorak
- Recently we use size allocation event to create wl_subsurface of MozContainer. Unfortunately size allocation event
  is not called when a window is opened second time, as its size is already set. Use map_event to create
  wl_subsurface in this case.

Differential Revision: https://phabricator.services.mozilla.com/D104551
2021-02-10 16:01:14 +00:00
stransky
0b889703e9 Bug 1667851 [Wayland] Guess subsurface offset from window decorations size, r=jhorak
- Try to set subsurface offset even if we mozcontainer size allocation is not finished. Use window decoration size for it.
- Add more logging to mozcontainer code.

Depends on D104549

Differential Revision: https://phabricator.services.mozilla.com/D104550
2021-02-10 16:01:13 +00:00
stransky
f3fadd9803 Bug 1667851 [Wayland] Rework mozcontainer wl_subsurface creation, r=jhorak
Rework wl_subsurface creation in these steps:

1) moz_container_wayland_size_allocate() handler is called when
   mContainer size/position is known.
   It calls moz_container_wayland_surface_create_locked(), registers
   a frame callback handler
   (moz_container_wayland_frame_callback_handler()).

2) moz_container_wayland_frame_callback_handler() is called
   when wl_surface owned by mozContainer is ready.
   We call initial_draw_cbs() handler and we can create our wl_subsurface
   on top of wl_surface owned by mozContainer.

Also size wl_buffer at WindowSurfaceWayland according to mozcontainer size,
don't use nsWindow bounds for it.

Differential Revision: https://phabricator.services.mozilla.com/D104549
2021-02-10 16:01:13 +00:00
Csoregi Natalia
9375c8b870 Backed out 3 changesets (bug 1667851) for causing build bustage on WindowSurfaceWayland.cpp. CLOSED TREE
Backed out changeset 8446b26d9c1d (bug 1667851)
Backed out changeset 9aefa43b4688 (bug 1667851)
Backed out changeset 8a5f4c0386c2 (bug 1667851)
2021-02-09 22:16:17 +02:00
stransky
7933f3c2bc Bug 1667851 [Wayland] Guess subsurface offset from window decorations size, r=jhorak
- Try to set subsurface offset even if we mozcontainer size allocation is not finished. Use window decoration size for it.
- Add more logging to mozcontainer code.

Depends on D104549

Differential Revision: https://phabricator.services.mozilla.com/D104550
2021-02-09 19:41:10 +00:00
stransky
bddb8992b4 Bug 1667851 [Wayland] Rework mozcontainer wl_subsurface creation, r=jhorak
Rework wl_subsurface creation in these steps:

1) moz_container_wayland_size_allocate() handler is called when
   mContainer size/position is known.
   It calls moz_container_wayland_surface_create_locked(), registers
   a frame callback handler
   (moz_container_wayland_frame_callback_handler()).

2) moz_container_wayland_frame_callback_handler() is called
   when wl_surface owned by mozContainer is ready.
   We call initial_draw_cbs() handler and we can create our wl_subsurface
   on top of wl_surface owned by mozContainer.

Also size wl_buffer at WindowSurfaceWayland according to mozcontainer size,
don't use nsWindow bounds for it.

Differential Revision: https://phabricator.services.mozilla.com/D104549
2021-02-09 19:41:09 +00:00
stransky
28620bed99 Bug 1687212 [Wayland] Set mAttached flag before wl_surface_commit() to avoid potential race condition, r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D104045
2021-02-04 14:09:52 +00:00
stransky
d3a109a0e9 Bug 1687212 [Wayland] Remove UnlockWaylandBuffer() and related code as it's not used, r=jhorak
Depends on D103185

Differential Revision: https://phabricator.services.mozilla.com/D103186
2021-01-28 06:50:50 +00:00
stransky
3c20423435 Bug 1687212 [Wayland] Provide wayland buffer logging to wayland window surface, r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D103185
2021-01-28 06:50:58 +00:00
Sylvestre Ledru
a617470289 Bug 1688372 - fix some reference to 'Glyph' is ambiguous r=andi
Just like we did in bug 1671813

Differential Revision: https://phabricator.services.mozilla.com/D102834
2021-01-23 12:07:07 +00:00
stransky
4a8ec774c7 Bug 1674473 [Wayland] Use gfx::DataSourceSurface instead of gfxImageSurface to cache drawing, r=lsalzman
Use gfx::DataSourceSurface instead of gfxImageSurface to cache drawing and don't use blending
when we paint cached images to Wayland buffer.

Differential Revision: https://phabricator.services.mozilla.com/D102238
2021-01-20 21:27:55 +00:00
stransky
5c56e4c045 Bug 1686703 [Wayland] Merge GetWaylandBufferWithSwitch()/GetWaylandBufferRecent() to GetWaylandBuffer(), r=jhorak
Depends on D101746

Differential Revision: https://phabricator.services.mozilla.com/D101747
2021-01-14 13:01:36 +00:00
stransky
ae1cdace17 Bug 1686703 [Wayland] Always resize wl_buffer after buffer switch, r=jhorak"
Depends on D101745

Differential Revision: https://phabricator.services.mozilla.com/D101746
2021-01-14 12:46:30 +00:00
stransky
8f0b303208 Bug 1686703 [Wayland] Don't switch wl_buffer for non-direct drawing, r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D101745
2021-01-14 12:45:11 +00:00
stransky
9ce5031178 Bug 1686341 [Wayland] Dump Wayland buffers to png files behind MOZ_WAYLAND_DUMP_WL_BUFFERS env pref, r=jhorak
Dump wayland buffers as png images when MOZ_WAYLAND_DUMP_WL_BUFFERS env variable is set and also log that.
The images are stored in recent working directory unless MOZ_WAYLAND_DUMP_DIR is set.

Differential Revision: https://phabricator.services.mozilla.com/D101581
2021-01-13 10:58:34 +00:00
stransky
2ef0cb2551 Bug 1685055 [Wayland] Post SyncBegin() to main thread only and remove thread specific code as it's unused, r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D101157
2021-01-12 21:07:22 +00:00
Bogdan Tara
0545759f73 Backed out 2 changesets (bug 1685055) for nsWaylandDisplay related bustage CLOSED TREE
Backed out changeset 813da913ec72 (bug 1685055)
Backed out changeset c46c76db0a48 (bug 1685055)
2021-01-11 22:27:24 +02:00
stransky
e8802ce8e3 Bug 1685055 [Wayland] Post SyncBegin() to main thread only and remove thread specific code as it's unused, r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D101157
2021-01-11 19:58:04 +00:00
stransky
1c8898846d Bug 1685537 [Wayland] Don't draw invisible windows, r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D101037
2021-01-08 10:09:49 +00:00
stransky
9be10fea0c Bug 1648698 [Wayland] Move nsWaylandDisplay::SyncBegin() out of FlushPendingCommitsLocked() call, r=rmader
- Move nsWaylandDisplay::SyncBegin() out of FlushPendingCommitsLocked() call to avoid a deadlock there
- Rename FlushPendingCommitsInternal() to FlushPendingCommitsLocked() to clearly state it operates on locked surface only.
- Implement nsWaylandDisplay::QueueSyncBegin() which delays SyncBegin() execution untill recent event batch is finished
  and use it instead of SyncBegin().

Differential Revision: https://phabricator.services.mozilla.com/D100384
2021-01-04 20:32:31 +00:00
stransky
e433ead34a Bug 1648698 [Wayland] Remove mIsMainThread from WindowSurfaceWayland as we use mutexes now, r=rmader
Differential Revision: https://phabricator.services.mozilla.com/D100327
2020-12-22 13:01:35 +00:00
stransky
5a1bb7df43 Bug 1648698 [Wayland] Protect WindowSurfaceWayland public methods by Mutex, r=rmader
As WindowSurfaceWayland can be acessed from various threads we need to guard public interface by mutex to avoid
threading issues. We also can't delete WindowSurfaceWayland internals untill it's used.

Depends on D100313

Differential Revision: https://phabricator.services.mozilla.com/D100314
2020-12-22 11:40:07 +00:00
stransky
eb4144dc88 Bug 1648698 [Wayland] Use g_timeout for delayed commits, r=rmader
Use g_timeout for delayed/pending commits instead of PostDelayedTask()/NewRunnableFunction()
and remove an active timeout when WindowSurfaceWayland is deleted.

Differential Revision: https://phabricator.services.mozilla.com/D100313
2020-12-22 11:41:06 +00:00
Simon Giesecke
1c53236b70 Bug 1679272 - Include ScopeExit.h exactly where used. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D98888
2020-12-07 14:25:59 +00:00
stransky
34adc75404 Bug 1677489 [Wayland] Use static mutex for delayed commits r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D97160
2020-11-18 13:33:04 +00:00
stransky
3081c62a8e Bug 1674982 [Wayland] Revert frame callbacks timeout due to OOM crashes, r=jhorak
Wayland protocol does not include a mechanism how to inform compositor about deleted frame callbacks.
We delete a callback only locally on client side and it remains active at server (compositor) side.

When large amount of callbacks is accumulated at server Firefox is closed due to OOM
so we need to keep frame callback on local side untill is fired and don't create a new one.

Differential Revision: https://phabricator.services.mozilla.com/D95678
2020-11-03 09:53:51 +00:00
stransky
9fda24b4c1 Bug 1673601 [Wayland] Remove WindowBackBufferShm and use only WindowBackBuffer, r=jhorak
Depends on https://phabricator.services.mozilla.com/D94735

Differential Revision: https://phabricator.services.mozilla.com/D94827
2020-10-28 13:32:23 +00:00
stransky
d478abbf50 Bug 1673313 [Wayland] Don't fail when Shm allocation fails, r=jhorak
- Make WaylandAllocateShmMemory() fallible.
- Implement WaylandReAllocateShmMemory() to re-allocate Shm pool.
- Remove WaylandShmPool::Resize() and use WaylandShmPool::Create() only.
- Implement and use WaylandShmPool::Release().
- Make WindowSurfaceWayland::CreateWaylandBuffer() as fallible.

Differential Revision: https://phabricator.services.mozilla.com/D94735
2020-10-28 11:35:05 +00:00
Mihai Alexandru Michis
2b08e93110 Backed out changeset dff839f08039 (bug 1673313) for causing bustages in WindowSurfaceWayland
CLOSED TREE
2020-10-27 16:50:47 +02:00
stransky
e2b50c1c65 Bug 1673313 [Wayland] Don't fail when Shm allocation fails, r=jhorak
- Make WaylandAllocateShmMemory() fallible.
- Implement WaylandReAllocateShmMemory() to re-allocate Shm pool.
- Remove WaylandShmPool::Resize() and use WaylandShmPool::Create() only.
- Implement and use WaylandShmPool::Release().
- Make WindowSurfaceWayland::CreateWaylandBuffer() as fallible.

Differential Revision: https://phabricator.services.mozilla.com/D94735
2020-10-27 14:21:02 +00:00
stransky
aeb4f0f089 Bug 1656727 [Wayland] Track delayed commits globally, r=jhorak
Track delayed commits in a global list and don't store them in actual wayland surfaces.
When a delayed commit is called, check that the associated wayland surface is still valid.

Differential Revision: https://phabricator.services.mozilla.com/D92432
2020-10-09 18:44:36 +00:00
stransky
023b95641e Bug 1668771 [Wayland] Use timeout for frame callbacks for basic compositor, r=jhorak
Differential Revision: https://phabricator.services.mozilla.com/D92200
2020-10-05 08:41:32 +00:00
Botond Ballo
4e4819d795 Bug 1667594 - Avoid including nsLayoutUtils.h in nsIFrame.h. r=emilio
The only thing in nsIFrame.h that was using it was the implementation
of a templated method, which could be moved to nsIFrameInlines.h.

Depends on D91504

Differential Revision: https://phabricator.services.mozilla.com/D91505
2020-09-26 18:18:11 +00:00